// File: BenLangmead[P]bowtie/./diff_sample.h
// Function: DifferenceCoverSample<SString<char>>::DifferenceCoverSample(SString<char> const&, unsigned int, bool, bool, std::ostream&)
DifferenceCoverSample(const TStr& __text,
	                      uint32_t __v,
	                      bool __verbose = false,
	                      bool __sanity = false,
	                      ostream& __logger = cout) :
		_text(__text),
		_v(__v),
		_verbose(__verbose),
		_sanity(__sanity),
		_ds(getDiffCover(_v, _verbose, _sanity)),
		_dmap(getDeltaMap(_v, _ds)),
		_d((uint32_t)_ds.size()),
		_doffs(),
		_isaPrime(),
		_dInv(),
		_log2v(myLog2(_v)),
		_vmask(OFF_MASK << _log2v),
		_logger(__logger)
	{
		assert_gt(_d, 0);
		assert_eq(1, popCount(_v)); // must be power of 2
		// Build map from d's to idx's
		_dInv.resizeExact((size_t)_v);
		_dInv.fill(0xffffffff);
		uint32_t lim = (uint32_t)_ds.size();
		for(uint32_t i = 0; i < lim; i++) {
			_dInv[_ds[i]] = i;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
andb $0x1, %cl
movb %cl, -0x15(%rbp)
andb $0x1, %al
movb %al, -0x16(%rbp)
movq %r9, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
movl -0x14(%rbp), %ecx
movl %ecx, 0x8(%rax)
movb -0x15(%rbp), %cl
andb $0x1, %cl
movb %cl, 0xc(%rax)
movb -0x16(%rbp), %cl
andb $0x1, %cl
movb %cl, 0xd(%rax)
movq %rax, %rdi
addq $0x10, %rdi
movq %rdi, -0x48(%rbp)
movl 0x8(%rax), %esi
movzbl 0xd(%rax), %ecx
movzbl 0xc(%rax), %edx
andl $0x1, %edx
andl $0x1, %ecx
callq 0x12080
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rdx
movq %rax, %rdi
addq $0x30, %rdi
movq %rdi, -0x40(%rbp)
movl 0x8(%rax), %esi
callq 0x12450
jmp 0x272ad
movq -0x50(%rbp), %rdi
addq $0x10, %rdi
callq 0x14440
movq -0x50(%rbp), %rdi
movl %eax, 0x50(%rdi)
addq $0x58, %rdi
movq %rdi, -0x58(%rbp)
callq 0x1b460
jmp 0x272d0
movq -0x50(%rbp), %rdi
addq $0x78, %rdi
movq %rdi, -0x60(%rbp)
callq 0x1b460
jmp 0x272e3
movq -0x50(%rbp), %rdi
addq $0x98, %rdi
movq %rdi, -0x68(%rbp)
callq 0x1b460
jmp 0x272f9
movq -0x50(%rbp), %rax
movq %rax, %rcx
addq $0xb8, %rcx
movq %rcx, -0x78(%rbp)
movl 0x8(%rax), %edi
callq 0x12660
movl %eax, -0x6c(%rbp)
jmp 0x27318
movq -0x50(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x6c(%rbp), %edx
movl %edx, (%rcx)
movb 0xb8(%rax), %cl
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0xbc(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0xc0(%rax)
movq %rax, %rdi
addq $0x98, %rdi
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0x2a3c0
jmp 0x2735b
movq -0x50(%rbp), %rdi
addq $0x98, %rdi
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
leaq -0x30(%rbp), %rsi
callq 0x2a440
jmp 0x27378
movq -0x50(%rbp), %rdi
addq $0x10, %rdi
callq 0x14440
movl %eax, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x27432
movq -0x50(%rbp), %rdi
movl -0x38(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq %rdi, %rax
addq $0x98, %rax
movq %rax, -0x88(%rbp)
addq $0x10, %rdi
movl -0x38(%rbp), %eax
movl %eax, %esi
callq 0x14410
movq -0x88(%rbp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x14410
movl -0x7c(%rbp), %ecx
movl %ecx, (%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x2738f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x27456
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2744d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x27444
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2743b
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x1d0c0
jmp 0x2743b
addq $0x90, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x1d0c0
movq -0x58(%rbp), %rdi
callq 0x1d0c0
movq -0x40(%rbp), %rdi
callq 0x1d0c0
movq -0x48(%rbp), %rdi
callq 0x1d0c0
movq -0x28(%rbp), %rdi
callq 0x6850
nopl (%rax,%rax)