// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl (%rdi), %eax
testl %eax, %eax
je 0x417402
movq %rdi, %r14
movl 0x8c(%rdi), %ebp
cmpl 0xb0(%rdi), %ebp
jne 0x41732f
movq 0x90(%r14), %rcx
cmpq 0xb8(%r14), %rcx
jne 0x41732f
movq 0x98(%r14), %rbx
jmp 0x417570
cmpl $0x1, %eax
jne 0x417409
movq 0x98(%r14), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x417402
movq 0x60(%r14), %r12
movl 0xa8(%r14), %eax
movq %rax, 0x8(%rsp)
movl 0x80(%r14), %r15d
movl 0x7c(%r14), %eax
movl %eax, 0x28(%rsp)
movq 0x90(%r14), %r14
leal -0x1(%r15), %eax
movl %eax, 0x24(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
addq %rax, %r12
incq %r12
movzbl -0x1(%r12), %eax
movl %eax, 0x1c(%rsp)
cmpl $0x2, %r15d
jb 0x4173bb
movl $0x8, %ecx
movl 0x24(%rsp), %edx
movzbl (%r12), %esi
shll %cl, %esi
orl %esi, %eax
movl %eax, 0x1c(%rsp)
incq %r12
addl $0x8, %ecx
decl %edx
jne 0x4173a4
cmpl $0x0, 0x28(%rsp)
je 0x4173da
leaq 0x20(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
movq %r15, %rdx
callq 0x401080
movl 0x20(%rsp), %eax
jmp 0x4173de
movl %eax, 0x20(%rsp)
cmpl %ebp, %eax
setae %cl
movl %eax, %eax
cmpq %rax, %r14
setae %al
andb %cl, %al
movzbl %al, %eax
addq %rax, %rbx
incq %r13
cmpq 0x10(%rsp), %r13
jne 0x417380
jmp 0x417570
xorl %ebx, %ebx
jmp 0x417570
movl 0x78(%r14), %ebp
testl %ebp, %ebp
je 0x41745a
movl %ebp, %eax
andl $0x3, %eax
movb $0x4, %cl
subb %al, %cl
testl %eax, %eax
movzbl %cl, %ecx
cmovel %eax, %ecx
movb %cl, 0x3c(%rsp)
movzbl %cl, %ebx
addl %ebp, %ebx
movl %ebx, %eax
andl $0x1f, %eax
shrl $0x5, %ebx
cmpl $0x1, %eax
sbbl $-0x1, %ebx
movl %ebx, 0x40(%rsp)
shll $0x3, %ebx
movq %rbx, %rdi
callq 0x41bd90
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x401098
jmp 0x41746a
movl $0x0, 0x40(%rsp)
movb $0x0, 0x3c(%rsp)
xorl %r15d, %r15d
movq %r15, 0x8(%rsp)
movq %r15, 0x30(%rsp)
movl %ebp, 0x38(%rsp)
movq %r14, %rdi
callq 0x4171ca
cmpq $0x0, 0x98(%r14)
je 0x417557
xorl %r15d, %r15d
leaq 0x30(%rsp), %r12
leaq 0x2c(%rsp), %r13
leaq 0x18(%rsp), %rbp
xorl %ebx, %ebx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x416c38
testb %al, %al
je 0x4174f3
cmpl $0x0, 0x7c(%r14)
je 0x4174db
movl 0x80(%r14), %edx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x401080
movss 0x18(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
jmp 0x4174f3
movl 0x2c(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movss %xmm0, 0x10(%rsp)
movss %xmm0, 0x18(%rsp)
movl 0x8c(%r14), %eax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movss 0x10(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jb 0x417545
movq 0x90(%r14), %rax
testq %rax, %rax
js 0x417523
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x41753b
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
ucomiss 0x10(%rsp), %xmm0
jb 0x417545
incq %rbx
incq %r15
cmpq 0x98(%r14), %r15
jb 0x4174a2
jmp 0x417559
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x4171ca
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x417570
callq 0x41aea0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x417584
movq %rax, %rbx
cmpq $0x0, 0x8(%rsp)
je 0x417599
movq 0x8(%rsp), %rdi
callq 0x41aea0
movq %rbx, %rdi
callq 0x4bfce0
nop