// File: 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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpl $0x0, (%rax)
je 0x42417c
movb $0x0, -0x1(%rbp)
jmp 0x4243e4
movq -0x88(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x424198
movq -0x88(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x4241a1
movb $0x0, -0x1(%rbp)
jmp 0x4243e4
movq -0x18(%rbp), %rsi
leaq 0x191f52(%rip), %rdx    # 0x5b60fe
leaq -0x40(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x41e940
movq -0x88(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq %rdi, %rdx
addq $0x20, %rdx
leaq 0x192cbc(%rip), %r8     # 0x5b6e94
leaq -0x20(%rbp), %rcx
callq 0x423920
movb %al, -0x89(%rbp)
jmp 0x4241e9
movb -0x89(%rbp), %al
xorb $-0x1, %al
movb %al, -0x99(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x49efd0
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x42420c
jmp 0x42422f
movb $0x0, -0x1(%rbp)
jmp 0x4243e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x49efd0
jmp 0x4243f2
movq -0x88(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movq %rsi, -0xa8(%rbp)
callq 0x423ab0
movq -0x88(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x5012c0
movq -0x88(%rbp), %rax
movq $0x0, 0x20(%rax)
movq 0x98(%rax), %rcx
testq %rcx, %rcx
sete 0x18(%rax)
movq -0x18(%rbp), %rsi
leaq 0x191e4b(%rip), %rdx    # 0x5b60c9
leaq -0x70(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x41e940
movq -0x88(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rcx
movq %rdi, %rdx
addq $0x28, %rdx
leaq 0x192be8(%rip), %r8     # 0x5b6e99
callq 0x423920
movb %al, -0x9a(%rbp)
jmp 0x4242be
movb -0x9a(%rbp), %al
xorb $-0x1, %al
movb %al, -0xb1(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x49efd0
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x4242e1
jmp 0x424304
movb $0x0, -0x1(%rbp)
jmp 0x4243e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x49efd0
jmp 0x4243f2
movq 0x212e6d(%rip), %rdi    # 0x637178
callq 0x42fb90
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rax
cmpq 0x212e3f(%rip), %rax    # 0x637178
jae 0x42434f
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0x42435d
movq 0x212e22(%rip), %rax    # 0x637178
movq %rax, -0xc0(%rbp)
movq -0x88(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movq 0x60(%rax), %rdi
movq -0x78(%rbp), %rdx
movq 0x28(%rax), %rcx
movl $0x1, %esi
callq 0x501c20
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x78(%rbp), %rax
je 0x4243ac
movq $0x1b907e0, %rdi        # imm = 0x1B907E0
leaq 0x192afd(%rip), %rsi    # 0x5b6e9e
callq 0x498c00
movb $0x0, -0x1(%rbp)
jmp 0x4243e4
movq -0x88(%rbp), %rax
movq -0x80(%rbp), %rdx
movq 0x8(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x8(%rax)
movl $0x2, (%rax)
movq $0x0, 0x40(%rax)
movq $0x0, 0x68(%rax)
movq $0x0, 0x70(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x4d3c10
nopl (%rax,%rax)