// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]optimal-seed-solver/RefDB.cc
// Function: RefDB::loadRefFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void RefDB::loadRefFile(string refName) {
	if (refFile.is_open()) {
		refFile.close();
		refPos.clear();
	}

	refFile.open(refName.c_str());

	if (!refFile.is_open()) {
		cerr << "RefFile open failed" << endl;
		exit(1);
	}

	string refMetaName = "." + refName + ".meta";
	fstream refMetaFile(refMetaName.c_str(), ios_base::in);

	if (refMetaFile.is_open()) {
		unsigned long int tempPos;
		while (refMetaFile >> tempPos) {
			refPos.push_back((streampos) tempPos);
		}

		cout << "refPos.size(): " << refPos.size() << endl;

	} else {

		refMetaFile.open(refMetaName.c_str(), ios_base::out | ios_base::trunc);

		string temp;
		streampos tempRefPos;

		while (refFile.good()) {
			tempRefPos = refFile.tellg();
			getline(refFile, temp);
			if (temp[0] == '>') {
				refPos.push_back(tempRefPos);
				refMetaFile << (unsigned long int) tempRefPos << endl;
			}
		}
	}

	refMetaFile.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x260, %rsp            # imm = 0x260
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x78(%rdi), %r15
movq %r15, %rdi
callq 0x2080
testb %al, %al
je 0x2875
movq %rbx, %rdi
callq 0x2060
movq 0x208(%rbx), %rax
cmpq %rax, 0x210(%rbx)
je 0x2875
movq %rax, 0x210(%rbx)
movq (%r14), %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x2130
movq %r15, %rdi
callq 0x2080
testb %al, %al
je 0x2a3b
leaq 0x17e9(%rip), %rsi      # 0x4083
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x2d69
leaq 0x17d4(%rip), %rdx      # 0x4085
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x2d4a
leaq 0x50(%rsp), %rdi
callq 0x20f0
movq 0x30(%rsp), %rsi
leaq 0x50(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x2280
leaq 0xd0(%rsp), %rdi
callq 0x2080
testb %al, %al
je 0x2938
leaq 0x208(%rbx), %r14
leaq 0x50(%rsp), %r15
movq %rsp, %r12
leaq 0x10(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x29cb
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x2ea4
jmp 0x28ff
movq 0x30(%rsp), %rsi
leaq 0x50(%rsp), %rdi
pushq $0x30
popq %rdx
callq 0x21a0
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
leaq 0x208(%rbx), %r15
leaq 0x60(%rsp), %r12
leaq 0x10(%rsp), %r13
movq (%rbx), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%rbx,%rax)
jne 0x2a02
movq %rbx, %rdi
callq 0x2320
movq %rax, (%rsp)
movq %rdx, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2050
movq 0x10(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x2976
movq %r15, %rdi
movq %r14, %rsi
callq 0x2de0
movq (%rsp), %rsi
movq %r12, %rdi
callq 0x2140
movq %rax, %rdi
callq 0x2100
jmp 0x2976
movq 0x35fe(%rip), %rdi      # 0x5fd0
leaq 0x16b2(%rip), %rsi      # 0x408b
callq 0x21c0
movq 0x210(%rbx), %rsi
subq 0x208(%rbx), %rsi
sarq $0x4, %rsi
movq %rax, %rdi
callq 0x2140
movq %rax, %rdi
callq 0x2100
jmp 0x2a0c
leaq 0x10(%rsp), %rdi
callq 0x20f0
leaq 0x50(%rsp), %rdi
callq 0x2030
leaq 0x50(%rsp), %rdi
callq 0x2070
leaq 0x30(%rsp), %rdi
callq 0x20f0
addq $0x260, %rsp            # imm = 0x260
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x35ae(%rip), %rdi      # 0x5ff0
leaq 0x1626(%rip), %rsi      # 0x406f
callq 0x21c0
movq %rax, %rdi
callq 0x2100
pushq $0x1
popq %rdi
callq 0x2230
movq %rax, %rbx
jmp 0x2a91
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x2a96
jmp 0x2a75
jmp 0x2a75
jmp 0x2a7a
jmp 0x2a75
movq %rax, %rbx
jmp 0x2a87
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x20f0
leaq 0x50(%rsp), %rdi
callq 0x2070
leaq 0x30(%rsp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2330
nop