// File: /workspace/github_cpp_makefile_star2_O1/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 0x41785a
movq %rdi, %r14
movl 0x8c(%rdi), %ebp
cmpl 0xb0(%rdi), %ebp
jne 0x417787
movq 0x90(%r14), %rcx
cmpq 0xb8(%r14), %rcx
jne 0x417787
movq 0x98(%r14), %rbx
jmp 0x4179b1
cmpl $0x1, %eax
jne 0x417861
movq 0x98(%r14), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x41785a
movq 0x60(%r14), %r12
movl 0xa8(%r14), %eax
movq %rax, 0x38(%rsp)
movl 0x80(%r14), %r15d
movl 0x7c(%r14), %eax
movl %eax, 0x18(%rsp)
movq 0x90(%r14), %r14
leal -0x1(%r15), %eax
movl %eax, 0x14(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
movq 0x38(%rsp), %rax
addq %rax, %r12
incq %r12
movzbl -0x1(%r12), %eax
movl %eax, 0xc(%rsp)
cmpl $0x2, %r15d
jb 0x417813
movl $0x8, %ecx
movl 0x14(%rsp), %edx
movzbl (%r12), %esi
shll %cl, %esi
orl %esi, %eax
movl %eax, 0xc(%rsp)
incq %r12
addl $0x8, %ecx
decl %edx
jne 0x4177fc
cmpl $0x0, 0x18(%rsp)
je 0x41782e
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
movq %r15, %rdx
callq 0x401080
jmp 0x417832
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
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 0x40(%rsp), %r13
jne 0x4177d8
jmp 0x4179b1
xorl %ebx, %ebx
jmp 0x4179b1
movl 0x78(%r14), %ebp
testl %ebp, %ebp
je 0x4178b4
movl %ebp, %eax
andl $0x3, %eax
movb $0x4, %cl
subb %al, %cl
testl %eax, %eax
movzbl %cl, %ecx
cmovel %eax, %ecx
movb %cl, 0x2c(%rsp)
movzbl %cl, %ebx
addl %ebp, %ebx
movl %ebx, %eax
andl $0x1f, %eax
shrl $0x5, %ebx
cmpl $0x1, %eax
sbbl $-0x1, %ebx
movl %ebx, 0x30(%rsp)
shll $0x3, %ebx
movq %rbx, %rdi
callq 0x41c2a0
movq %rax, 0x20(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x401098
jmp 0x4178ca
movq $0x0, 0x20(%rsp)
movl $0x0, 0x30(%rsp)
movb $0x0, 0x2c(%rsp)
movl %ebp, 0x28(%rsp)
movq %r14, %rdi
callq 0x417622
cmpq $0x0, 0x98(%r14)
je 0x417998
xorl %ebp, %ebp
leaq 0x20(%rsp), %r15
leaq 0x1c(%rsp), %r12
leaq 0x8(%rsp), %r13
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4170d6
testb %al, %al
je 0x417936
cmpl $0x0, 0x7c(%r14)
je 0x417924
movl 0x80(%r14), %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x401080
jmp 0x417936
movl 0x1c(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movss %xmm0, 0x8(%rsp)
movl 0x8c(%r14), %eax
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
movss 0x8(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x417986
movq 0x90(%r14), %rax
testq %rax, %rax
js 0x417966
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
jmp 0x41797e
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jb 0x417986
incq %rbx
incq %rbp
cmpq 0x98(%r14), %rbp
jb 0x4178f7
jmp 0x41799a
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x417622
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4179b1
callq 0x41b3b0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4179c5
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4179d7
callq 0x41b3b0
movq %rbx, %rdi
callq 0x4c0230
nop