// File: /workspace/github_cpp_makefile_star2_O3/ChnMasterOG[P]KmerGO2/kmc_api/kmc_file.cpp
// Function: CKMCFile::OpenForListing(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool CKMCFile::OpenForListing(const std::string &file_name)
{
	uint64 size;

	if (is_opened)
		return false;
	
	if (file_pre || file_suf)
		return false;

	if (!OpenASingleFile(file_name + ".kmc_pre", file_pre, size, (char *)"KMCP"))
		return false;

	ReadParamsFrom_prefix_file_buf(size);
	fclose(file_pre);
	file_pre = NULL;

	end_of_file = total_kmers == 0;

	if (!OpenASingleFile(file_name + ".kmc_suf", file_suf, size, (char *)"KMCS"))
		return false;

	sufix_file_buf = new uchar[part_size];

	suffix_file_total_to_read = size;
	suf_file_left_to_read = suffix_file_total_to_read;
	auto to_read = MIN(suf_file_left_to_read, part_size);
	auto readed = fread(sufix_file_buf, 1, to_read, file_suf);
	if (readed != to_read)
	{
		std::cerr << "Error: some error while reading suffix file\n";
		return false;
	}

	suf_file_left_to_read -= readed;

	is_opened = opened_for_listing;
	prefix_index = 0;
	sufix_number = 0;
	index_in_partial_buf = 0;
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x0, (%rdi)
jne 0x4167a4
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
jne 0x4167a4
cmpq $0x0, 0x28(%rbx)
jne 0x4167a4
movq %rsi, %r14
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x408000
leaq 0x18baa7(%rip), %rsi    # 0x5a20fe
movq %r15, %rdi
callq 0x48d320
leaq 0x20(%rbx), %rdx
leaq 0x18c832(%rip), %r8     # 0x5a2e9c
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %rcx
movq %r15, %rsi
callq 0x416112
movl %eax, %ebp
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x416693
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41ae90
testb %bpl, %bpl
je 0x4167a4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x416208
movq 0x20(%rbx), %rdi
callq 0x4ed390
movq $0x0, 0x20(%rbx)
cmpq $0x0, 0x98(%rbx)
sete 0x18(%rbx)
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x408000
leaq 0x18b9db(%rip), %rsi    # 0x5a20c9
movq %r14, %rdi
callq 0x48d320
leaq 0x28(%rbx), %rdx
leaq 0x18c7a0(%rip), %r8     # 0x5a2ea1
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %rcx
movq %r14, %rsi
callq 0x416112
movl %eax, %ebp
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x41672a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41ae90
testb %bpl, %bpl
je 0x4167a4
movq 0x202a42(%rip), %r14    # 0x619178
movq %r14, %rdi
callq 0x41bd90
movq %rax, 0x60(%rbx)
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rbx)
movq %rcx, 0x8(%rbx)
cmpq %r14, %rcx
cmovbq %rcx, %r14
movq 0x28(%rbx), %rcx
movl $0x1, %esi
movq %rax, %rdi
movq %r14, %rdx
callq 0x4edcf0
cmpq %r14, %rax
jne 0x41678c
subq %r14, 0x8(%rbx)
movl $0x2, (%rbx)
movq $0x0, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rbx)
movb $0x1, %al
jmp 0x4167a6
movq $0x1b71840, %rdi        # imm = 0x1B71840
leaq 0x18c70c(%rip), %rsi    # 0x5a2ea6
movl $0x2c, %edx
callq 0x485270
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4167b5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x4167ce
movq (%r12), %rsi
incq %rsi
callq 0x41ae90
movq %rbx, %rdi
callq 0x4bfce0