// File: CMU-SAFARI[P]optimal-seed-solver/getReference.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;

	while (1) {
		cout << "please input chromo number: " << endl;
		int tempChromoNum;
		cin >> tempChromoNum;
		if (tempChromoNum != chromo_number) {
			chromo_number = tempChromoNum;
			refDB.loadChromo(chromo_number);
		}

		cout << "please input location: " << endl;
		cin >> location;
		cout << "please input length: " << endl;
		cin >> length;

		cout << refDB.getRefSeq(location, length) << endl;
	}
	return 0;
}

// Assembly:
subq $0x338, %rsp            # imm = 0x338
movl $0x0, 0x334(%rsp)
movl %edi, 0x330(%rsp)
movq %rsi, 0x328(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x3cb0
cmpl $0x2, 0x330(%rsp)
je 0x36a8
movq 0x5991(%rip), %rdi      # 0x8ff0
leaq 0x299e(%rip), %rsi      # 0x6004
callq 0x3230
movq %rax, 0x50(%rsp)
jmp 0x3672
movq 0x50(%rsp), %rdi
movq 0x593a(%rip), %rsi      # 0x8fb8
callq 0x3270
jmp 0x3685
movl $0x1, %edi
callq 0x32e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
jmp 0x3932
movq 0x328(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x40(%rsp)
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x3440
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq 0x90(%rsp), %rdi
callq 0x3950
jmp 0x36e4
leaq 0xc0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x3d60
jmp 0x36fb
leaq 0x90(%rsp), %rdi
callq 0x3180
leaq 0x8f(%rsp), %rdi
callq 0x3290
movl $0xffffffff, 0x88(%rsp) # imm = 0xFFFFFFFF
movq 0x58a1(%rip), %rdi      # 0x8fc8
leaq 0x28fe(%rip), %rsi      # 0x602c
callq 0x3230
movq %rax, 0x38(%rsp)
jmp 0x373a
leaq 0xc0(%rsp), %rdi
callq 0x44b0
movl %eax, 0x34(%rsp)
jmp 0x374d
movl 0x34(%rsp), %esi
movq 0x38(%rsp), %rdi
callq 0x3330
movq %rax, 0x28(%rsp)
jmp 0x3762
movq 0x28(%rsp), %rdi
movq 0x584a(%rip), %rsi      # 0x8fb8
callq 0x3270
jmp 0x3775
jmp 0x3777
jmp 0x3779
movq 0x5848(%rip), %rdi      # 0x8fc8
leaq 0x28ba(%rip), %rsi      # 0x6041
callq 0x3230
movq %rax, 0x20(%rsp)
jmp 0x3793
movq 0x20(%rsp), %rdi
movq 0x5819(%rip), %rsi      # 0x8fb8
callq 0x3270
jmp 0x37a6
movq 0x582b(%rip), %rdi      # 0x8fd8
leaq 0x7c(%rsp), %rsi
callq 0x3170
jmp 0x37b9
movl 0x7c(%rsp), %eax
cmpl 0x88(%rsp), %eax
je 0x3832
movl 0x7c(%rsp), %eax
movl %eax, 0x88(%rsp)
movl 0x88(%rsp), %esi
leaq 0xc0(%rsp), %rdi
callq 0x41e0
jmp 0x37e7
jmp 0x3832
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
jmp 0x3820
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x3180
leaq 0x8f(%rsp), %rdi
callq 0x3290
jmp 0x3932
movq 0x578f(%rip), %rdi      # 0x8fc8
leaq 0x281e(%rip), %rsi      # 0x605e
callq 0x3230
movq %rax, 0x18(%rsp)
jmp 0x384c
movq 0x18(%rsp), %rdi
movq 0x5760(%rip), %rsi      # 0x8fb8
callq 0x3270
jmp 0x385f
movq 0x5772(%rip), %rdi      # 0x8fd8
leaq 0x84(%rsp), %rsi
callq 0x3170
jmp 0x3875
movq 0x574c(%rip), %rdi      # 0x8fc8
leaq 0x27f3(%rip), %rsi      # 0x6076
callq 0x3230
movq %rax, 0x10(%rsp)
jmp 0x388f
movq 0x10(%rsp), %rdi
movq 0x571d(%rip), %rsi      # 0x8fb8
callq 0x3270
jmp 0x38a2
movq 0x572f(%rip), %rdi      # 0x8fd8
leaq 0x80(%rsp), %rsi
callq 0x3170
jmp 0x38b8
movl 0x84(%rsp), %edx
movl 0x80(%rsp), %ecx
leaq 0x58(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x4500
jmp 0x38da
movq 0x56e7(%rip), %rdi      # 0x8fc8
leaq 0x58(%rsp), %rsi
callq 0x3210
movq %rax, 0x8(%rsp)
jmp 0x38f2
movq 0x8(%rsp), %rdi
movq 0x56ba(%rip), %rsi      # 0x8fb8
callq 0x3270
jmp 0x3905
leaq 0x58(%rsp), %rdi
callq 0x3180
jmp 0x3777
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x3180
leaq 0xc0(%rsp), %rdi
callq 0x3d10
movq 0xb8(%rsp), %rdi
callq 0x3430
nopl (%rax)