// File: BenLangmead[P]bowtie/./diff_sample.h
// Function: EList<unsigned int, 128> getDiffCover<unsigned int>(unsigned int, bool, bool)
static EList<T> getDiffCover(T v,
                              bool verbose = false,
                              bool sanityCheck = false)
{
	assert_gt(v, 2);
	EList<T> ret;

	// Can we look it up in our hardcoded array?
	if(v <= 64 && dc0to64[v][0] == 0xffffffff) {
		if(verbose) cout << "v in hardcoded area, but hardcoded entry was all-fs" << endl;
		return ret;
	} else if(v <= 64) {
		ret.push_back(0);
		for(size_t i = 0; i < 10; i++) {
			if(dc0to64[v][i] == 0) break;
			ret.push_back(dc0to64[v][i]);
		}
		if(sanityCheck) assert(dcRepOk(v, ret));
		return ret;
	}

	// Can we look it up in our calcColbournAndLingDCs array?
	if(!clDCs_calced) {
		calcColbournAndLingDCs<uint32_t>(verbose, sanityCheck);
		assert(clDCs_calced);
	}
	for(size_t i = 0; i < 16; i++) {
		if(v <= clDCs[i].maxV) {
			for(size_t j = 0; j < clDCs[i].numSamples; j++) {
				T s = clDCs[i].samples[j];
				if(s >= v) {
					s %= v;
					for(size_t k = 0; k < ret.size(); k++) {
						if(s == ret[k]) break;
						if(s < ret[k]) {
							ret.insert(s, k);
							break;
						}
					}
				} else {
					ret.push_back(s % v);
				}
			}
			if(sanityCheck) assert(dcRepOk(v, ret));
			return ret;
		}
	}
	cerr << "Error: Could not find a difference cover sample for v=" << v << endl;
	throw 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x68(%rbp)
movb %cl, %al
movb %dl, %cl
movq %rdi, %rdx
movq %rdx, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %cl
movb %cl, -0xd(%rbp)
andb $0x1, %al
movb %al, -0xe(%rbp)
movb $0x0, -0xf(%rbp)
callq 0x1b460
cmpl $0x40, -0xc(%rbp)
ja 0x12130
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x407b9(%rip), %rax     # 0x52880
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
jne 0x12130
testb $0x1, -0xd(%rbp)
je 0x12120
movq 0x3fec8(%rip), %rdi     # 0x51fa8
leaq 0x343cf(%rip), %rsi     # 0x464b6
callq 0x6410
movq %rax, -0x70(%rbp)
jmp 0x120f2
movq -0x70(%rbp), %rdi
movq 0x3fe6b(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0x12104
jmp 0x12120
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x1d0c0
jmp 0x123eb
movb $0x1, -0xf(%rbp)
movl $0x1, -0x20(%rbp)
jmp 0x123cf
cmpl $0x40, -0xc(%rbp)
ja 0x121cb
movq -0x68(%rbp), %rdi
movl $0x0, -0x24(%rbp)
leaq -0x24(%rbp), %rsi
callq 0x22210
jmp 0x12150
movq $0x0, -0x30(%rbp)
cmpq $0xa, -0x30(%rbp)
jae 0x121b3
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x40715(%rip), %rax     # 0x52880
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x1217e
jmp 0x121b3
movq -0x68(%rbp), %rdi
movl -0xc(%rbp), %eax
leaq (%rax,%rax,4), %rcx
leaq 0x406f0(%rip), %rax     # 0x52880
leaq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rcx
leaq (%rax,%rcx,4), %rsi
callq 0x22210
jmp 0x121a3
jmp 0x121a5
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12158
testb $0x1, -0xe(%rbp)
je 0x121bb
jmp 0x121bb
movb $0x1, -0xf(%rbp)
movl $0x1, -0x20(%rbp)
jmp 0x123cf
jmp 0x121cd
testb $0x1, 0x42cf8(%rip)     # 0x54ecc
jne 0x121ed
movzbl -0xe(%rbp), %esi
movzbl -0xd(%rbp), %edi
andl $0x1, %edi
andl $0x1, %esi
callq 0x22280
jmp 0x121eb
jmp 0x121ed
movq $0x0, -0x38(%rbp)
cmpq $0x10, -0x38(%rbp)
jae 0x12361
movl -0xc(%rbp), %eax
leaq 0x42cc6(%rip), %rcx     # 0x54ed0
imulq $0x208, -0x38(%rbp), %rdx # imm = 0x208
addq %rdx, %rcx
cmpl (%rcx), %eax
ja 0x1234e
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
leaq 0x42ca0(%rip), %rcx     # 0x54ed0
imulq $0x208, -0x38(%rbp), %rdx # imm = 0x208
addq %rdx, %rcx
movl 0x4(%rcx), %ecx
cmpq %rcx, %rax
jae 0x12336
leaq 0x42c82(%rip), %rax     # 0x54ed0
imulq $0x208, -0x38(%rbp), %rcx # imm = 0x208
addq %rcx, %rax
movq -0x40(%rbp), %rcx
movl 0x8(%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jb 0x12305
movl -0xc(%rbp), %ecx
movl -0x44(%rbp), %eax
xorl %edx, %edx
divl %ecx
movl %edx, -0x44(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x68(%rbp), %rdi
movq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
callq 0x14440
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jae 0x12303
movq -0x68(%rbp), %rdi
movl -0x44(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq -0x50(%rbp), %rsi
callq 0x14410
movq %rax, %rcx
movl -0x7c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x122c1
jmp 0x12303
movq -0x68(%rbp), %rdi
movl -0x44(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x50(%rbp), %rsi
callq 0x14410
movq %rax, %rcx
movl -0x80(%rbp), %eax
cmpl (%rcx), %eax
jae 0x122f3
movq -0x68(%rbp), %rdi
movq -0x50(%rbp), %rdx
leaq -0x44(%rbp), %rsi
callq 0x22760
jmp 0x122f1
jmp 0x12303
jmp 0x122f5
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x12285
jmp 0x12323
movq -0x68(%rbp), %rdi
movl -0x44(%rbp), %eax
movl -0xc(%rbp), %ecx
xorl %edx, %edx
divl %ecx
movl %edx, -0x54(%rbp)
leaq -0x54(%rbp), %rsi
callq 0x22210
jmp 0x12321
jmp 0x12323
jmp 0x12325
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12225
testb $0x1, -0xe(%rbp)
je 0x1233e
jmp 0x1233e
movb $0x1, -0xf(%rbp)
movl $0x1, -0x20(%rbp)
jmp 0x123cf
jmp 0x12350
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x121f5
movq 0x3fc88(%rip), %rdi     # 0x51ff0
leaq 0x3417b(%rip), %rsi     # 0x464ea
callq 0x6410
movq %rax, -0x88(%rbp)
jmp 0x1237d
movq -0x88(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x65f0
movq %rax, -0x90(%rbp)
jmp 0x12395
movq -0x90(%rbp), %rdi
movq 0x3fbc5(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0x123aa
movl $0x4, %edi
callq 0x61f0
movq %rax, %rdi
movl $0x1, (%rdi)
movq 0x3fb8c(%rip), %rsi     # 0x51f50
xorl %eax, %eax
movl %eax, %edx
callq 0x67f0
jmp 0x123f4
testb $0x1, -0xf(%rbp)
jne 0x123de
movq -0x68(%rbp), %rdi
callq 0x1d0c0
movq -0x60(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x6850
nopw %cs:(%rax,%rax)