// File: CMU-SAFARI[P]optimal-seed-solver/RefDB.cc
// Function: RefDB::loadChromo(int)
bool RefDB::loadChromo(int chromoNum) {
	if (curChromoNum == chromoNum)
			return true;

	curChromoNum = chromoNum;

	cout << "RefDB loading chromosome: " << chromoNum << endl;

	if (chromoNum >= refPos.size())
		return false;

	chromosome.clear();
	refFile.clear();
	refFile.seekg(refPos[chromoNum]);

	getline(refFile, chromoName);

	string temp;

	while (refFile.good() && (temp.size() == 0 || temp[0] != '<')) {
		chromosome.append(temp);
		getline(refFile, temp);
		if (temp[0] == '>') {
			cout << "stop!" << endl;
			break;
		}
	}

	return true;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x78(%rsp)
movl %esi, 0x74(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x28(%rsp)
movl 0x260(%rax), %eax
cmpl 0x74(%rsp), %eax
jne 0x42b3
movb $0x1, 0x87(%rsp)
jmp 0x44cb
movq 0x28(%rsp), %rax
movl 0x74(%rsp), %ecx
movl %ecx, 0x260(%rax)
movq 0x4d07(%rip), %rdi      # 0x8fd0
leaq 0x1dcb(%rip), %rsi      # 0x609b
callq 0x3240
movq %rax, %rdi
movl 0x74(%rsp), %esi
callq 0x3470
movq %rax, %rdi
movq 0x4cd5(%rip), %rsi      # 0x8fc0
callq 0x3280
movq 0x28(%rsp), %rdi
movslq 0x74(%rsp), %rax
movq %rax, 0x20(%rsp)
addq $0x208, %rdi            # imm = 0x208
callq 0x4ae0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jb 0x4325
movb $0x0, 0x87(%rsp)
jmp 0x44cb
movq 0x28(%rsp), %rdi
addq $0x240, %rdi            # imm = 0x240
callq 0x3360
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x3430
movq 0x28(%rsp), %rdi
addq $0x208, %rdi            # imm = 0x208
movslq 0x74(%rsp), %rsi
callq 0x4bd0
movq 0x28(%rsp), %rdi
movq (%rax), %rcx
movq %rcx, 0x60(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
callq 0x3340
movq 0x28(%rsp), %rdi
movq %rdi, %rsi
addq $0x220, %rsi            # imm = 0x220
callq 0x3070
leaq 0x40(%rsp), %rdi
callq 0x3380
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3440
movb %al, 0x1f(%rsp)
jmp 0x43bc
movb 0x1f(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x1e(%rsp)
jne 0x43cd
jmp 0x4415
leaq 0x40(%rsp), %rdi
callq 0x31b0
movq %rax, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, 0x1d(%rsp)
je 0x440d
xorl %eax, %eax
movl %eax, %esi
leaq 0x40(%rsp), %rdi
callq 0x34f0
movq %rax, 0x10(%rsp)
jmp 0x43fb
movq 0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3c, %eax
setne %al
movb %al, 0x1d(%rsp)
movb 0x1d(%rsp), %al
movb %al, 0x1e(%rsp)
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x4422
jmp 0x44b9
movq 0x28(%rsp), %rdi
addq $0x240, %rdi            # imm = 0x240
leaq 0x40(%rsp), %rsi
callq 0x34d0
jmp 0x443a
movq 0x28(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3070
jmp 0x444b
xorl %eax, %eax
movl %eax, %esi
leaq 0x40(%rsp), %rdi
callq 0x34f0
movq %rax, 0x8(%rsp)
jmp 0x4460
movq 0x8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0x44b4
movq 0x4b5c(%rip), %rdi      # 0x8fd0
leaq 0x1c3b(%rip), %rsi      # 0x60b6
callq 0x3240
movq %rax, (%rsp)
jmp 0x4486
movq (%rsp), %rdi
movq 0x4b2f(%rip), %rsi      # 0x8fc0
callq 0x3280
jmp 0x4498
jmp 0x44b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x3180
jmp 0x44dc
jmp 0x43a2
movb $0x1, 0x87(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x3180
movb 0x87(%rsp), %al
andb $0x1, %al
addq $0x88, %rsp
retq
movq 0x38(%rsp), %rdi
callq 0x3490
nopw %cs:(%rax,%rax)