// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/./diff_sample.h
// Function: void calcColbournAndLingDCs<unsigned int>(bool, bool)
void calcColbournAndLingDCs(bool verbose = false, bool sanityCheck = false) {
	for(T r = 0; r < 16; r++) {
		T maxv = 24*r*r + 36*r + 13; // Corollary 2.3
		T numsamp = 6*r + 4;
		clDCs[r].maxV = maxv;
		clDCs[r].numSamples = numsamp;
		memset(clDCs[r].samples, 0, 4 * 128);
		T i;
		// clDCs[r].samples[0] = 0;
		// Fill in the 1^r part of the B series
		for(i = 1; i < r+1; i++) {
			clDCs[r].samples[i] = clDCs[r].samples[i-1] + 1;
		}
		// Fill in the (r + 1)^1 part
		clDCs[r].samples[r+1] = clDCs[r].samples[r] + r + 1;
		// Fill in the (2r + 1)^r part
		for(i = r+2; i < r+2+r; i++) {
			clDCs[r].samples[i] = clDCs[r].samples[i-1] + 2*r + 1;
		}
		// Fill in the (4r + 3)^(2r + 1) part
		for(i = r+2+r; i < r+2+r+2*r+1; i++) {
			clDCs[r].samples[i] = clDCs[r].samples[i-1] + 4*r + 3;
		}
		// Fill in the (2r + 2)^(r + 1) part
		for(i = r+2+r+2*r+1; i < r+2+r+2*r+1+r+1; i++) {
			clDCs[r].samples[i] = clDCs[r].samples[i-1] + 2*r + 2;
		}
		// Fill in the last 1^r part
		for(i = r+2+r+2*r+1+r+1; i < r+2+r+2*r+1+r+1+r; i++) {
			clDCs[r].samples[i] = clDCs[r].samples[i-1] + 1;
		}
		assert_eq(i, numsamp);
		assert_lt(i, 128);
		if(sanityCheck) {
			// diffs[] records all the differences observed
			bool *diffs = new bool[maxv];
			for(T i = 0; i < numsamp; i++) {
				for(T j = i+1; j < numsamp; j++) {
					T d1 = (clDCs[r].samples[j] - clDCs[r].samples[i]);
					T d2 = (clDCs[r].samples[i] + maxv - clDCs[r].samples[j]);
					assert_lt(d1, maxv);
					assert_lt(d2, maxv);
					diffs[d1] = true;
					diffs[d2] = true;
				}
			}
			// Should have observed all possible differences (except 0)
			for(T i = 1; i < maxv; i++) {
				if(diffs[i] == false) cout << r << ", " << i << endl;
				assert(diffs[i] == true);
			}
			delete[] diffs;
		}
	}
	clDCs_calced = true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
pushq $0x2
popq %r8
pushq $0x3
popq %rdi
pushq $0x4
popq %r9
leaq 0x22550(%rip), %r10     # 0x34dbc
leaq 0x2254d(%rip), %r11     # 0x34dc0
leaq 0x2254a(%rip), %rax     # 0x34dc4
movq %rax, 0x48(%rsp)
leaq 0x22542(%rip), %rbx     # 0x34dc8
xorl %edx, %edx
movb $0x1, %r14b
movq %r11, %r15
movq %r9, 0x58(%rsp)
movq %r8, 0x50(%rsp)
movl %esi, 0x24(%rsp)
cmpq $0x10, %rdx
je 0x12b1d
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r9, 0x18(%rsp)
movq %rdi, 0x38(%rsp)
movq %r8, 0x40(%rsp)
imull $0x18, %edx, %r13d
addl $0x24, %r13d
imulq %rdx, %r13
addq $0xd, %r13
imulq $0x6, %rdx, %r12
addq $0x4, %r12
imulq $0x208, %rdx, %rax      # imm = 0x208
leaq 0x224cb(%rip), %rcx     # 0x34db0
leaq (%rax,%rcx), %rbp
addq $0x8, %rbp
movl %r13d, -0x8(%rbp)
movl %r12d, -0x4(%rbp)
movq %rdx, 0x8(%rsp)
movl $0x200, %edx            # imm = 0x200
movq %rbp, %rdi
xorl %esi, %esi
movq %r10, 0x10(%rsp)
callq 0x51b0
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %r10
xorl %eax, %eax
cmpq %rax, %rdx
je 0x1292c
leaq 0x1(%rax), %rcx
movl %ecx, (%r10,%rax,4)
movq %rcx, %rax
jmp 0x1291a
leaq 0x1(%rdx), %rcx
movl (%rbp,%rdx,4), %eax
movq %rcx, 0x60(%rsp)
addl %ecx, %eax
movl %eax, 0x4(%rbp,%rdx,4)
leaq (%rdx,%rdx), %rax
leaq 0x2(,%rdx,2), %rcx
leal 0x1(%rax), %edx
xorl %esi, %esi
movq 0x40(%rsp), %r8
movq 0x18(%rsp), %r9
movq 0x30(%rsp), %r11
movq 0x50(%rsp), %rdi
addq %rsi, %rdi
cmpq %rcx, %rdi
jae 0x1297c
movl -0x4(%r15,%rsi,4), %edi
addl %edx, %edi
movl %edi, (%r15,%rsi,4)
incq %rsi
jmp 0x1295f
addq %rax, %rcx
movq 0x8(%rsp), %rdx
leal 0x3(,%rdx,4), %edx
xorl %esi, %esi
leaq (%r8,%rsi), %rdi
cmpq %rcx, %rdi
ja 0x129a6
movl -0x4(%r11,%rsi,4), %edi
addl %edx, %edi
movl %edi, (%r11,%rsi,4)
incq %rsi
jmp 0x1298d
movq 0x8(%rsp), %rdx
addq %rdx, %rcx
incq %rcx
addl $0x2, %eax
xorl %edx, %edx
movq 0x38(%rsp), %rdi
leaq (%rdi,%rdx), %rsi
cmpq %rcx, %rsi
ja 0x129d7
movq 0x48(%rsp), %rbx
movl -0x4(%rbx,%rdx,4), %esi
addl %eax, %esi
movl %esi, (%rbx,%rdx,4)
incq %rdx
jmp 0x129bb
movq 0x8(%rsp), %rax
addq %rcx, %rax
incq %rax
xorl %ecx, %ecx
movq 0x28(%rsp), %rbx
movq 0x58(%rsp), %rdx
addq %rcx, %rdx
cmpq %rax, %rdx
jae 0x12a04
movl -0x4(%rbx,%rcx,4), %edx
incl %edx
movl %edx, (%rbx,%rcx,4)
incq %rcx
jmp 0x129e9
movl 0x24(%rsp), %esi
testb %sil, %sil
je 0x12ad7
movq %r13, %rdi
callq 0x5030
movq 0x18(%rsp), %r10
movq %rax, %rbx
movq 0x10(%rsp), %rax
xorl %ecx, %ecx
pushq $0x1
popq %rdx
cmpq %r10, %rcx
je 0x12a68
xorl %esi, %esi
leaq (%rdx,%rsi), %rdi
cmpq %r12, %rdi
jae 0x12a5c
movl (%rax,%rsi,4), %edi
movl (%rbp,%rcx,4), %r8d
movl %r13d, %r9d
subl %edi, %r9d
subl %r8d, %edi
addl %r8d, %r9d
movb %r14b, (%rbx,%rdi)
movb %r14b, (%rbx,%r9)
incq %rsi
jmp 0x12a32
incq %rcx
incq %rdx
addq $0x4, %rax
jmp 0x12a2b
pushq $0x1
popq %rbp
movq 0x1f52e(%rip), %r12     # 0x31fa0
cmpq %r13, %rbp
jae 0x12ab1
cmpb $0x0, (%rbx,%rbp)
jne 0x12aac
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x51e0
movq %rax, %rdi
leaq 0x121fd(%rip), %rsi     # 0x24c91
callq 0x5350
movq %rax, %rdi
movq %rbp, %rsi
callq 0x51e0
movq %rax, %rdi
callq 0x5180
incq %rbp
jmp 0x12a72
movq %rbx, %rdi
callq 0x5440
movq 0x18(%rsp), %r9
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %r10
movq 0x30(%rsp), %r11
movq 0x28(%rsp), %rbx
incq 0x50(%rsp)
addq $0x2, %r8
addq $0x4, %rdi
addq $0x5, 0x58(%rsp)
addq $0x6, %r9
addq $0x208, %r10            # imm = 0x208
addq $0x20c, %r15            # imm = 0x20C
addq $0x210, %r11            # imm = 0x210
addq $0x218, 0x48(%rsp)      # imm = 0x218
addq $0x21c, %rbx            # imm = 0x21C
movq 0x60(%rsp), %rdx
jmp 0x1289c
movb $0x1, 0x22288(%rip)     # 0x34dac
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop