// File: /workspace/github_cpp_makefile_star2_O2/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 0x2a18
cmpl $0x2, %ebp
jne 0x28d3
movq 0x8(%rbx), %rsi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x2944
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x2aa8
leaq 0x20(%rsp), %rdi
callq 0x20e0
movq 0x3b2a(%rip), %rdi      # 0x5fd0
leaq 0x1b7f(%rip), %rsi      # 0x402c
callq 0x21a0
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2eb6
movl %eax, %esi
movq %rbx, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20f0
xorl %ebx, %ebx
leaq 0x40(%rsp), %r14
movq %rsp, %rbp
movl $0x80045, %r15d         # imm = 0x80045
movq %r14, %rdi
callq 0x2eb6
cmpl %eax, %ebx
jae 0x28b5
movq %r14, %rdi
movl %ebx, %esi
callq 0x2d1c
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x2eae
cmpl %eax, %r13d
jae 0x28ae
movq %r14, %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x2faa
movl %eax, %r12d
movzbl %al, %eax
addl $-0x41, %eax
cmpl $0x13, %eax
ja 0x2541
btl %eax, %r15d
jae 0x2538
movl %r13d, %r12d
jmp 0x28a3
cmpl $0xd, %eax
je 0x25c7
movq 0x3a88(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x1ae8(%rip), %rsi      # 0x4041
callq 0x21a0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x1b39(%rip), %rsi      # 0x40ac
callq 0x21a0
movsbl %r12b, %esi
movq %rax, %rdi
callq 0x2200
movq %rax, %rdi
callq 0x20f0
leal -0x5(%r13), %edx
movq %rbp, %rdi
movq %r14, %rsi
pushq $0xb
popq %rcx
callq 0x2ee0
movq 0x3a2b(%rip), %rdi      # 0x5fd0
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20f0
movq %rbp, %rdi
callq 0x20e0
cmpb $0x4e, %r12b
jne 0x2530
leal 0x1(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x2faa
cmpb $0x4e, %al
jne 0x2673
leal 0x2(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x2faa
cmpb $0x4e, %al
jne 0x26e3
leal 0x3(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x2faa
cmpb $0x4e, %al
jne 0x2753
leal 0x4(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x2faa
cmpb $0x4e, %al
jne 0x27c3
leal 0x5(%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x2faa
cmpb $0x4e, %al
jne 0x2830
movl %r13d, %r12d
movq %r14, %rdi
callq 0x2eae
cmpl %eax, %r12d
jae 0x28a3
leal 0x1(%r12), %r13d
movq %r14, %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x2faa
cmpb $0x4e, %al
je 0x2644
jmp 0x28a3
movq 0x3956(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x19b6(%rip), %rsi      # 0x4041
callq 0x21a0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x199e(%rip), %rsi      # 0x4043
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
addl $-0x5, %r13d
movq %rbp, %rdi
movq %r14, %rsi
movl %r13d, %edx
pushq $0xb
popq %rcx
callq 0x2ee0
movq 0x3902(%rip), %rdi      # 0x5fd0
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20f0
jmp 0x289b
movq 0x38e6(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x1946(%rip), %rsi      # 0x4041
callq 0x21a0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x1932(%rip), %rsi      # 0x4047
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
addl $-0x5, %r13d
movq %rbp, %rdi
movq %r14, %rsi
movl %r13d, %edx
pushq $0xc
popq %rcx
callq 0x2ee0
movq 0x3892(%rip), %rdi      # 0x5fd0
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20f0
jmp 0x289b
movq 0x3876(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x18d6(%rip), %rsi      # 0x4041
callq 0x21a0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x18c7(%rip), %rsi      # 0x404c
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
addl $-0x5, %r13d
movq %rbp, %rdi
movq %r14, %rsi
movl %r13d, %edx
pushq $0xd
popq %rcx
callq 0x2ee0
movq 0x3822(%rip), %rdi      # 0x5fd0
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20f0
jmp 0x289b
movq 0x3806(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x1866(%rip), %rsi      # 0x4041
callq 0x21a0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x185d(%rip), %rsi      # 0x4052
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
addl $-0x5, %r13d
movq %rbp, %rdi
movq %r14, %rsi
movl %r13d, %edx
pushq $0xe
popq %rcx
callq 0x2ee0
movq 0x37b2(%rip), %rdi      # 0x5fd0
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20f0
jmp 0x289b
movq 0x3799(%rip), %rdi      # 0x5fd0
movl %ebx, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x17f9(%rip), %rsi      # 0x4041
callq 0x21a0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x17f0(%rip), %rsi      # 0x4052
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
addl $-0x5, %r13d
movq %rbp, %rdi
movq %r14, %rsi
movl %r13d, %edx
pushq $0xf
popq %rcx
callq 0x2ee0
movq 0x3745(%rip), %rdi      # 0x5fd0
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20f0
movq %rbp, %rdi
callq 0x20e0
incl %r12d
movl %r12d, %r13d
jmp 0x24fe
incl %ebx
jmp 0x24e1
leaq 0x40(%rsp), %rdi
callq 0x2a76
xorl %eax, %eax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3716(%rip), %rdi      # 0x5ff0
leaq 0x1723(%rip), %rsi      # 0x4004
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
pushq $0x1
popq %rdi
callq 0x2210
jmp 0x292f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x2926
jmp 0x292f
jmp 0x292f
jmp 0x292f
jmp 0x292f
jmp 0x2920
jmp 0x2920
jmp 0x292f
jmp 0x2920
jmp 0x292f
jmp 0x292f
jmp 0x292f
jmp 0x2920
jmp 0x292f
jmp 0x2920
jmp 0x292f
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20e0
jmp 0x2932
jmp 0x292f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2a76
movq %rbx, %rdi
callq 0x22c0