// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]optimal-seed-solver/testReference.cc
// Function: main
int main(int argc, const char* argv[]) {
	RefDB refDB;
	if (argc != 2) {
		cerr << "Please also put the reference file name" << endl;
		exit(1);
	}

	refDB.loadRefFile(argv[1]);

	int chromo_number = -1;
	int location;
	int length;

	cout << "Num of chromosomes: " << refDB.getNumOfChromo() << endl;

	for (int i = 0; i < refDB.getNumOfChromo(); i++) {
		refDB.loadChromo(i);
		for (int j = 0; j < refDB.getChromoLength(); j++) {
			char base = refDB.getRefBase(j, 0);
			if (base != 'A' && base != 'C' && base != 'G' && base != 'T' && base != 'N') {
				cout << i << "-" << j << ": " << base << endl;
				cout << refDB.getRefSeq(j - 5, 11) << endl;
			}

			if (base == 'N') {
				if (refDB.getRefBase(j+1, 0) != 'N') {
					cout << i << "-" << j << ": N" << endl;
					cout << refDB.getRefSeq(j - 5, 11) << endl;
					j++;
				}
				else if (refDB.getRefBase(j+2, 0) != 'N') {
					cout << i << "-" << j << ": NN" << endl;
					cout << refDB.getRefSeq(j - 5, 12) << endl;
					j = j + 2;
				}
				else if (refDB.getRefBase(j+3, 0) != 'N') {
					cout << i << "-" << j << ": NNN" << endl;
					cout << refDB.getRefSeq(j - 5, 13) << endl;
					j = j + 3;
				}
				else if (refDB.getRefBase(j+4, 0) != 'N') {
					cout << i << "-" << j << ": NNNN" << endl;
					cout << refDB.getRefSeq(j - 5, 14) << endl;
					j = j + 4;
				}
				else if (refDB.getRefBase(j+5, 0) != 'N') {
					cout << i << "-" << j << ": NNNN" << endl;
					cout << refDB.getRefSeq(j - 5, 15) << endl;
					j = j + 5;
				}
				else {
					while (j < refDB.getChromoLength() && refDB.getRefBase(j+1, 0) == 'N' )
						j++;
				}
			}
		}
	
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x40(%rsp), %rdi
callq 0x2cac
cmpl $0x2, %ebp
jne 0x2b39
movq 0x8(%rbx), %rsi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x2bd6
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x2d6e
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2490
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x3b39(%rip), %rdi      # 0x5fd0
leaq 0x1b8e(%rip), %rsi      # 0x402c
movl $0x14, %edx
callq 0x21f0
leaq 0x40(%rsp), %rdi
callq 0x33a6
movl %eax, %esi
movq 0x3b15(%rip), %rdi      # 0x5fd0
callq 0x2110
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
xorl %ebx, %ebx
leaq 0x40(%rsp), %r14
movl $0x80045, %r15d         # imm = 0x80045
movq %r14, %rdi
callq 0x33a6
cmpl %eax, %ebx
jae 0x2b1b
movq %r14, %rdi
movl %ebx, %esi
callq 0x314e
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x339e
cmpl %eax, %r13d
jae 0x2b14
movq %r14, %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x3586
movl %eax, %r12d
movzbl %al, %eax
addl $-0x41, %eax
cmpl $0x13, %eax
ja 0x255a
btl %eax, %r15d
jae 0x2551
movl %r13d, %r12d
incl %r12d
movl %r12d, %r13d
jmp 0x2514
cmpl $0xd, %eax
je 0x2657
movq 0x3a6f(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x2270
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1ac7(%rip), %rsi      # 0x4041
callq 0x21f0
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %rbp
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1b10(%rip), %rsi      # 0x40ac
callq 0x21f0
movb %r12b, (%rsp)
movl $0x1, %edx
movq %rbp, %rdi
movq %rsp, %rsi
callq 0x21f0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
leal -0x5(%r13), %edx
movq %rsp, %rdi
movq %r14, %rsi
movl $0xb, %ecx
callq 0x33e4
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x39cd(%rip), %rdi      # 0x5fd0
callq 0x21f0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x264d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
cmpb $0x4e, %r12b
jne 0x2546
leal 0x1(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x3586
cmpb $0x4e, %al
jne 0x2703
leal 0x2(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x3586
cmpb $0x4e, %al
jne 0x27cd
leal 0x3(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x3586
cmpb $0x4e, %al
jne 0x2897
leal 0x4(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x3586
cmpb $0x4e, %al
jne 0x2961
leal 0x5(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x3586
cmpb $0x4e, %al
jne 0x2a2b
movl %r13d, %r12d
movq %r14, %rdi
callq 0x339e
cmpl %eax, %r12d
jae 0x2549
leal 0x1(%r12), %r13d
movq %r14, %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x3586
cmpb $0x4e, %al
je 0x26d4
jmp 0x2549
movq 0x38c6(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x2270
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x191e(%rip), %rsi      # 0x4041
callq 0x21f0
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %rbp
movl $0x3, %edx
movq %rax, %rdi
leaq 0x18fe(%rip), %rsi      # 0x4043
callq 0x21f0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
addl $-0x5, %r13d
movq %rsp, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl $0xb, %ecx
callq 0x33e4
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x3837(%rip), %rdi      # 0x5fd0
callq 0x21f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
jmp 0x2af0
movq 0x37fc(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x2270
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1854(%rip), %rsi      # 0x4041
callq 0x21f0
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %rbp
movl $0x4, %edx
movq %rax, %rdi
leaq 0x1838(%rip), %rsi      # 0x4047
callq 0x21f0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
addl $-0x5, %r13d
movq %rsp, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl $0xc, %ecx
callq 0x33e4
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x376d(%rip), %rdi      # 0x5fd0
callq 0x21f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
jmp 0x2af0
movq 0x3732(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x2270
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x178a(%rip), %rsi      # 0x4041
callq 0x21f0
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %rbp
movl $0x5, %edx
movq %rax, %rdi
leaq 0x1773(%rip), %rsi      # 0x404c
callq 0x21f0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
addl $-0x5, %r13d
movq %rsp, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl $0xd, %ecx
callq 0x33e4
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x36a3(%rip), %rdi      # 0x5fd0
callq 0x21f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
jmp 0x2af0
movq 0x3668(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x2270
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x16c0(%rip), %rsi      # 0x4041
callq 0x21f0
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %rbp
movl $0x6, %edx
movq %rax, %rdi
leaq 0x16af(%rip), %rsi      # 0x4052
callq 0x21f0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
addl $-0x5, %r13d
movq %rsp, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl $0xe, %ecx
callq 0x33e4
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x35d9(%rip), %rdi      # 0x5fd0
callq 0x21f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
jmp 0x2af0
movq 0x359e(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x2270
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x15f6(%rip), %rsi      # 0x4041
callq 0x21f0
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %rbp
movl $0x6, %edx
movq %rax, %rdi
leaq 0x15e5(%rip), %rsi      # 0x4052
callq 0x21f0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
addl $-0x5, %r13d
movq %rsp, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl $0xf, %ecx
callq 0x33e4
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x350f(%rip), %rdi      # 0x5fd0
callq 0x21f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2549
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x2549
incl %ebx
jmp 0x24f7
leaq 0x40(%rsp), %rdi
callq 0x2d0a
xorl %eax, %eax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x34b0(%rip), %rdi      # 0x5ff0
leaq 0x14bd(%rip), %rsi      # 0x4004
movl $0x27, %edx
callq 0x21f0
movq 0x3498(%rip), %rdi      # 0x5ff0
callq 0x20d0
movl $0x1, %edi
callq 0x2210
jmp 0x2bc1
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bc4
movq 0x30(%rsp), %rsi
jmp 0x2bb5
jmp 0x2bc1
jmp 0x2bc1
jmp 0x2bc1
jmp 0x2bc1
jmp 0x2b9f
jmp 0x2bc1
jmp 0x2bc1
jmp 0x2b9f
jmp 0x2bc1
jmp 0x2b9f
jmp 0x2bc1
jmp 0x2bc1
jmp 0x2bc1
jmp 0x2b9f
jmp 0x2b9f
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2bc4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x2bc4
jmp 0x2bc1
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2d0a
movq %rbx, %rdi
callq 0x2290