// File: /workspace/github_cpp_makefile_star2_O1/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 0x416c20
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
jne 0x416c20
cmpq $0x0, 0x28(%rbx)
jne 0x416c20
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 0x40805e
leaq 0x18c62b(%rip), %rsi    # 0x5a30fe
movq %r15, %rdi
callq 0x48d830
leaq 0x20(%rbx), %rdx
leaq 0x18d3ba(%rip), %r8     # 0x5a3ea0
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %rcx
movq %r15, %rsi
callq 0x41658e
movl %eax, %ebp
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x416b0f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41b3a0
testb %bpl, %bpl
je 0x416c20
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x416684
movq 0x20(%rbx), %rdi
callq 0x4ed8e0
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 0x40805e
leaq 0x18c55f(%rip), %rsi    # 0x5a30c9
movq %r14, %rdi
callq 0x48d830
leaq 0x28(%rbx), %rdx
leaq 0x18d328(%rip), %r8     # 0x5a3ea5
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %rcx
movq %r14, %rsi
callq 0x41658e
movl %eax, %ebp
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x416ba6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41b3a0
testb %bpl, %bpl
je 0x416c20
movq 0x2035c6(%rip), %r14    # 0x61a178
movq %r14, %rdi
callq 0x41c2a0
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 0x4ee240
cmpq %r14, %rax
jne 0x416c08
subq %rax, 0x8(%rbx)
movl $0x2, (%rbx)
movq $0x0, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rbx)
movb $0x1, %al
jmp 0x416c22
movq $0x1b72840, %rdi        # imm = 0x1B72840
leaq 0x18d294(%rip), %rsi    # 0x5a3eaa
movl $0x2c, %edx
callq 0x485780
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x416c31
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x416c4a
movq (%r12), %rsi
incq %rsi
callq 0x41b3a0
movq %rbx, %rdi
callq 0x4c0230