// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/./multikey_qsort.h
// Function: void qsortSufDcU8<S2bDnaString, S2bDnaString>(S2bDnaString const&, S2bDnaString const&, unsigned long, unsigned long*, unsigned long, DifferenceCoverSample<S2bDnaString> const&, unsigned long, unsigned long, bool)
inline
void qsortSufDcU8(const T1& host1,
                  const T2& host,
                  size_t hlen,
                  TIndexOffU* s,
                  size_t slen,
                  const DifferenceCoverSample<T1>& dc,
                  size_t begin,
                  size_t end,
                  bool sanityCheck = false)
{
	assert_leq(end, slen);
	assert_lt(begin, slen);
	assert_gt(end, begin);
	size_t n = end - begin;
	if(n <= 1) return;                 // 1-element list already sorted
	// Note: rand() didn't really cut it here; it seemed to run out of
	// randomness and, after a time, returned the same thing over and
	// over again
	size_t a = (rand() % n) + begin; // choose pivot between begin and end
	assert_lt(a, end);
	assert_geq(a, begin);
	SWAP(s, end-1, a); // move pivot to end
	size_t cur = 0;
	for(size_t i = begin; i < end-1; i++) {
		if(sufDcLtU8(host1, host, hlen, s[i], s[end-1], dc, sanityCheck)) {
#ifndef NDEBUG
			if(sanityCheck) {
				assert(sstr_suf_lt(host1, s[i], hlen, host1, s[end-1], hlen, false));
			}
			assert_lt(begin + cur, end-1);

#endif
			SWAP(s, i, begin + cur);
			cur++;
		}
	}
	// Put pivot into place
	assert_lt(cur, end-begin);
	SWAP(s, end-1, begin+cur);
	if(begin+cur > begin) qsortSufDcU8(host1, host, hlen, s, slen, dc, begin, begin+cur);
	if(end > begin+cur+1) qsortSufDcU8(host1, host, hlen, s, slen, dc, begin+cur+1, end);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, 0x18(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, 0x28(%rsp)
movq 0x98(%rsp), %r13
movq %r8, 0x8(%rsp)
cmpq %r8, %r13
ja 0x21339
movq %r9, %rbp
movq %rdx, %r15
movb 0xa0(%rsp), %al
movl %eax, 0x14(%rsp)
movq 0x90(%rsp), %r12
leaq -0x1(%r13), %rbx
movq %rdx, 0x48(%rsp)
cmpq 0x8(%rsp), %r12
jae 0x20fc1
movq %r13, %r14
subq %r12, %r14
jbe 0x20f1e
cmpq $0x2, %r14
jb 0x20d44
callq 0x40e0
cltq
xorl %edx, %edx
movq %r14, 0x40(%rsp)
divq %r14
movq %rdx, %r14
addq %r12, %r14
cmpq %r13, %r14
jae 0x21066
cmpq %r12, %r14
jb 0x21109
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0xca37
movzbl 0x14(%rsp), %eax
andl $0x1, %eax
movq %rax, 0x50(%rsp)
movq $0x0, 0x20(%rsp)
movq %r12, %r14
movq %r12, 0x30(%rsp)
cmpq %rbx, %r14
jae 0x20cc1
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rcx
movq -0x8(%rax,%r13,8), %r8
subq $0x8, %rsp
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r15, %rdx
movq %rbp, %r9
pushq 0x58(%rsp)
callq 0x213de
popq %rcx
popq %rdx
testb %al, %al
je 0x20cb9
testb $0x1, 0x14(%rsp)
je 0x20c71
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rsi
movq -0x8(%rax,%r13,8), %r8
movq 0x28(%rsp), %rcx
movq %rcx, %rdi
movq %r15, %rdx
movq %r15, %r9
callq 0xd07a
testb %al, %al
je 0x20eff
movq 0x20(%rsp), %rax
leaq (%rax,%r12), %r15
cmpq %rbx, %r15
jae 0x20db4
cmpq %r12, %r14
jb 0x20d53
cmpq %r12, %r15
jb 0x20e5a
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0xca37
incq 0x20(%rsp)
movq 0x30(%rsp), %r12
movq 0x48(%rsp), %r15
incq %r14
jmp 0x20c07
movq 0x20(%rsp), %r14
movq 0x40(%rsp), %rax
cmpq %rax, %r14
jae 0x211ea
addq %r12, %r14
jb 0x211ac
cmpq %r13, %r14
jae 0x21293
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0xca37
cmpq %r12, %r14
jbe 0x20d2d
subq $0x8, %rsp
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r15, %rdx
movq 0x20(%rsp), %rcx
movq 0x10(%rsp), %r8
movq %rbp, %r9
pushq $0x0
pushq %r14
pushq %r12
callq 0x20b35
addq $0x20, %rsp
incq %r14
movl $0x0, 0x14(%rsp)
movq %r14, %r12
cmpq %r13, %r14
jb 0x20b8a
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1325e(%rip), %rbx     # 0x33fb8
leaq 0x74e4(%rip), %rsi      # 0x28245
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
leaq 0x74e1(%rip), %rsi      # 0x2825c
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
leaq 0x9683(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9f71(%rip), %r14      # 0x2ad1d
movq %rbx, %rdi
jmp 0x20eb8
movq %rbx, %r14
movq 0x131fa(%rip), %rbx     # 0x33fb8
leaq 0x74c2(%rip), %rsi      # 0x28287
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
leaq 0x74be(%rip), %rsi      # 0x2829d
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
leaq 0x961f(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9f0d(%rip), %r14      # 0x2ad1d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42d0
leaq 0x8919(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x335, %esi            # imm = 0x335
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x87d5(%rip), %rdi      # 0x2961b
leaq 0xa09f(%rip), %rcx      # 0x2aeec
movq %r14, %rsi
movl $0x335, %edx            # imm = 0x335
callq 0x4190
movq 0x13157(%rip), %r12     # 0x33fb8
leaq 0x73dd(%rip), %rsi      # 0x28245
movq %r12, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
leaq 0x73da(%rip), %rsi      # 0x2825c
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x40b0
leaq 0x957a(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9e68(%rip), %r14      # 0x2ad1d
movq %r12, %rdi
movq %r14, %rsi
callq 0x42d0
leaq 0x8874(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x338, %esi            # imm = 0x338
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x8730(%rip), %rdi      # 0x2961b
leaq 0x9ffa(%rip), %rcx      # 0x2aeec
movq %r14, %rsi
movl $0x338, %edx            # imm = 0x338
callq 0x4190
leaq 0xa08e(%rip), %rdi      # 0x2af94
leaq 0x9e10(%rip), %rsi      # 0x2ad1d
leaq 0x9fd8(%rip), %rcx      # 0x2aeec
movl $0x333, %edx            # imm = 0x333
callq 0x4190
movq 0x13093(%rip), %rbx     # 0x33fb8
leaq 0x720c(%rip), %rsi      # 0x28138
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x40b0
leaq 0x7208(%rip), %rsi      # 0x2814e
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
leaq 0x94b8(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9da6(%rip), %r14      # 0x2ad1d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42d0
leaq 0x87b2(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x324, %esi            # imm = 0x324
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x866e(%rip), %rdi      # 0x2961b
leaq 0x9f38(%rip), %rcx      # 0x2aeec
movq %r14, %rsi
movl $0x324, %edx            # imm = 0x324
callq 0x4190
movq 0x12ff0(%rip), %rbx     # 0x33fb8
leaq 0x72b8(%rip), %rsi      # 0x28287
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
leaq 0x72b4(%rip), %rsi      # 0x2829d
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x40b0
leaq 0x9413(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9d01(%rip), %r14      # 0x2ad1d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42d0
leaq 0x870d(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x323, %esi            # imm = 0x323
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x85c9(%rip), %rdi      # 0x2961b
leaq 0x9e93(%rip), %rcx      # 0x2aeec
movq %r14, %rsi
movl $0x323, %edx            # imm = 0x323
callq 0x4190
movq 0x12f4b(%rip), %rbx     # 0x33fb8
leaq 0x7213(%rip), %rsi      # 0x28287
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
leaq 0x720f(%rip), %rsi      # 0x2829d
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x40b0
leaq 0x9370(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9c5e(%rip), %r14      # 0x2ad1d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42d0
leaq 0x866a(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x32b, %esi            # imm = 0x32B
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x8526(%rip), %rdi      # 0x2961b
leaq 0x9df0(%rip), %rcx      # 0x2aeec
movq %r14, %rsi
movl $0x32b, %edx            # imm = 0x32B
callq 0x4190
movq 0x12ea8(%rip), %rbx     # 0x33fb8
leaq 0x712e(%rip), %rsi      # 0x28245
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
leaq 0x712b(%rip), %rsi      # 0x2825c
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
leaq 0x92cd(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9bbb(%rip), %r14      # 0x2ad1d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42d0
leaq 0x85c7(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x32c, %esi            # imm = 0x32C
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x8483(%rip), %rdi      # 0x2961b
leaq 0x9d4d(%rip), %rcx      # 0x2aeec
movq %r14, %rsi
movl $0x32c, %edx            # imm = 0x32C
callq 0x4190
movq %r14, %rbx
movq 0x12e02(%rip), %r14     # 0x33fb8
leaq 0x7088(%rip), %rsi      # 0x28245
movq %r14, %rdi
callq 0x42d0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
leaq 0x7085(%rip), %rsi      # 0x2825c
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r12, %rsi
jmp 0x212cc
movq %r14, %rbx
movq 0x12dc4(%rip), %r14     # 0x33fb8
movq %rax, %r15
leaq 0x7089(%rip), %rsi      # 0x28287
movq %r14, %rdi
callq 0x42d0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
leaq 0x7085(%rip), %rsi      # 0x2829d
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
leaq 0x91e6(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9ad4(%rip), %rbx      # 0x2ad1d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x42d0
leaq 0x84e0(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x33d, %esi            # imm = 0x33D
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x839c(%rip), %rdi      # 0x2961b
leaq 0x9c66(%rip), %rcx      # 0x2aeec
movq %rbx, %rsi
movl $0x33d, %edx            # imm = 0x33D
callq 0x4190
movq %r14, %rbx
movq 0x12d1b(%rip), %r14     # 0x33fb8
leaq 0x6fe3(%rip), %rsi      # 0x28287
movq %r14, %rdi
callq 0x42d0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
leaq 0x6fdf(%rip), %rsi      # 0x2829d
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x40b0
leaq 0x9140(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9a2e(%rip), %rbx      # 0x2ad1d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x42d0
leaq 0x843a(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x33e, %esi            # imm = 0x33E
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x82f6(%rip), %rdi      # 0x2961b
leaq 0x9bc0(%rip), %rcx      # 0x2aeec
movq %rbx, %rsi
movl $0x33e, %edx            # imm = 0x33E
callq 0x4190
movq 0x12c78(%rip), %rbx     # 0x33fb8
leaq 0x6e9c(%rip), %rsi      # 0x281e3
movq %rbx, %rdi
callq 0x42d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x40b0
leaq 0x6e99(%rip), %rsi      # 0x281fa
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x40b0
leaq 0x909b(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
leaq 0x9989(%rip), %r14      # 0x2ad1d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42d0
leaq 0x8395(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0x322, %esi            # imm = 0x322
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x8251(%rip), %rdi      # 0x2961b
leaq 0x9b1b(%rip), %rcx      # 0x2aeec
movq %r14, %rsi
movl $0x322, %edx            # imm = 0x322
callq 0x4190