// File: ChnMasterOG[P]KmerGO2/kmc_api/kmc_file.cpp
// Function: CKMCFile::KmerCount()
uint64 CKMCFile::KmerCount(void)
{
	if(is_opened)
		if((min_count == original_min_count) && (max_count == original_max_count))
			return total_kmers;
		else
		{
			uint32 count;
			uint32 int_counter;
			uint64 aux_kmerCount = 0;

			if(is_opened == opened_for_RA)
			{
				uchar *ptr = sufix_file_buf;
				
				for(uint64 i = 0; i < total_kmers; i++)		
				{
					ptr += sufix_size;
					int_counter = *ptr;
					ptr++;

					for(uint32 b = 1; b < counter_size; b ++)
					{
						uint32 aux = 0x000000ff & *(ptr);
						aux = aux << 8 * ( b);
						int_counter = aux | int_counter;
						ptr++;
					}
					
					if(mode == 0)
						count = int_counter;
					else
						memcpy(&count, &int_counter, counter_size);
	
					if((count >= min_count) && (count <= max_count))
						aux_kmerCount++;
				}
			}
			else //opened_for_listing
			{
				CKmerAPI kmer(kmer_length);
				float count;
				RestartListing();
				for(uint64 i = 0; i < total_kmers; i++)		
				{
					ReadNextKmer(kmer, count);
					if((count >= min_count) && (count <= max_count))
						aux_kmerCount++;
				}
				RestartListing();
			}
			return aux_kmerCount;
		}
	else
		return 0 ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpl $0x0, (%rax)
je 0x425ae3
movq -0x78(%rbp), %rcx
movl 0x8c(%rcx), %eax
cmpl 0xb0(%rcx), %eax
jne 0x42589a
movq -0x78(%rbp), %rcx
movq 0x90(%rcx), %rax
cmpq 0xb8(%rcx), %rax
jne 0x42589a
movq -0x78(%rbp), %rax
movq 0x98(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x425aeb
movq -0x78(%rbp), %rax
movq $0x0, -0x20(%rbp)
cmpl $0x1, (%rax)
jne 0x4259c6
movq -0x78(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x78(%rbp), %rcx
movq -0x30(%rbp), %rax
cmpq 0x98(%rcx), %rax
jae 0x4259c1
movq -0x78(%rbp), %rax
movl 0xa8(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl $0x1, -0x34(%rbp)
movq -0x78(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl 0x80(%rcx), %eax
jae 0x425958
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
andl $0xff, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x34(%rbp), %ecx
shll $0x3, %ecx
shll %cl, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
orl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x42590c
movq -0x78(%rbp), %rax
cmpl $0x0, 0x7c(%rax)
jne 0x42596a
movl -0x18(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x425983
movq -0x78(%rbp), %rax
movl 0x80(%rax), %eax
movl %eax, %edx
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x401080
movq -0x78(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x8c(%rcx), %eax
jb 0x4259ae
movq -0x78(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpq 0x90(%rcx), %rax
ja 0x4259ae
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x4259b0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x4258c3
jmp 0x425ad9
movq -0x78(%rbp), %rax
movl 0x78(%rax), %esi
leaq -0x50(%rbp), %rdi
callq 0x40b540
movq -0x78(%rbp), %rdi
callq 0x4255b0
jmp 0x4259e1
movq $0x0, -0x70(%rbp)
movq -0x78(%rbp), %rcx
movq -0x70(%rbp), %rax
cmpq 0x98(%rcx), %rax
jae 0x425ac5
movq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x54(%rbp), %rdx
callq 0x424c80
jmp 0x425a11
movq -0x78(%rbp), %rax
movss -0x54(%rbp), %xmm0
movl 0x8c(%rax), %eax
cvtsi2ss %rax, %xmm1
ucomiss %xmm1, %xmm0
jb 0x425ab2
movq -0x78(%rbp), %rax
movss -0x54(%rbp), %xmm0
movss %xmm0, -0x84(%rbp)
movq 0x90(%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x80(%rbp)
testq %rax, %rax
movss %xmm0, -0x7c(%rbp)
js 0x425a7b
movss -0x80(%rbp), %xmm0
movss %xmm0, -0x7c(%rbp)
movss -0x84(%rbp), %xmm1
movss -0x7c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x425ab2
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x425ab2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x40bcf0
jmp 0x425af8
jmp 0x425ab4
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x4259e9
movq -0x78(%rbp), %rdi
callq 0x4255b0
jmp 0x425ad0
leaq -0x50(%rbp), %rdi
callq 0x40bcf0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x425aeb
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x4d3c10
nopw %cs:(%rax,%rax)