// File: /workspace/github_cpp_makefile_star2_O3/chahk0129[P]hash_bench/./index/extendible_hash.h
// Function: ExtendibleHash<char [32]>::Utilization()
double ExtendibleHash<Key_t>::Utilization(void){
    size_t sum = 0;
    size_t cnt = 0;
    for(size_t i=0; i<dir->capacity; cnt++){
	auto target = dir->_[i];
	auto stride = pow(2, dir->depth - target->local_depth);
	auto pattern = (i >> (dir->depth - target->local_depth));
	for(unsigned j=0; j<Segment<Key_t>::kNumSlot; ++j){
	    size_t key_hash;
	    if constexpr(sizeof(Key_t) > 8){
		key_hash = hash_funcs[0](target->_[j].key, sizeof(Key_t) ,f_seed);
		if(((key_hash >> (8*sizeof(size_t) - target->local_depth)) == pattern) && (memcmp(target->_[j].key, INVALID<Key_t>, sizeof(Key_t)) != 0)){
		    sum++;
		}
	    }
	    else{
		key_hash = hash_funcs[0](&target->_[j].key, sizeof(Key_t), f_seed);
		if(((key_hash >> (8*sizeof(key_hash)-target->local_depth)) == pattern) && (memcmp(&target->_[j].key, &INVALID<Key_t>, sizeof(Key_t)) != 0)){
		    sum++;
		}
	    }
	}
	i += stride;
    }
    return ((double)sum) / ((double)cnt * Segment<Key_t>::kNumSlot)*100.0;
}

// Assembly:
movq 0x8(%rdi), %rax
cmpq $0x0, 0x10(%rax)
je 0x9fc8
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0x4208(%rip), %xmm4     # 0xe040
movapd 0x4210(%rip), %xmm2     # 0xe050
xorl %r12d, %r12d
xorl %ecx, %ecx
xorl %ebx, %ebx
movq %rdi, (%rsp)
movq %rcx, 0x8(%rsp)
movq (%rax), %rcx
movq 0x18(%rax), %rax
movq (%rcx,%rbx,8), %rbp
subq 0xa000(%rbp), %rax
movq %rax, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm2, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
callq 0x2190
movapd %xmm0, 0x10(%rsp)
movq 0x8(%r14), %rax
movl 0x18(%rax), %ecx
subl 0xa000(%rbp), %ecx
movq %rbx, %r13
shrq %cl, %r13
xorl %r15d, %r15d
leaq (%r15,%rbp), %r14
movl $0x20, %esi
movl $0xc70697, %edx         # imm = 0xC70697
movq %r14, %rdi
callq 0x2050
xorl %ecx, %ecx
subb 0xa000(%rbp), %cl
shrq %cl, %rax
cmpq %r13, %rax
jne 0x9ef2
movdqu (%r14), %xmm0
movdqu 0x10(%r14), %xmm1
pcmpeqb 0xb40b(%rip), %xmm1     # 0x152e0
pcmpeqb 0xb3f3(%rip), %xmm0     # 0x152d0
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
xorl %ecx, %ecx
cmpl $0xffff, %eax           # imm = 0xFFFF
setne %cl
addq %rcx, %r12
addq $0x28, %r15
cmpq $0xa000, %r15           # imm = 0xA000
jne 0x9e9c
movq %rbx, %xmm0
movq 0x4134(%rip), %xmm4     # 0xe040
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
movapd 0x4138(%rip), %xmm2     # 0xe050
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x415a(%rip), %xmm0     # 0xe0a0
cvttsd2si %xmm0, %rbx
andq %rcx, %rbx
orq %rax, %rbx
movq 0x8(%rsp), %rcx
incq %rcx
movq (%rsp), %r14
movq 0x8(%r14), %rax
cmpq %rbx, 0x10(%rax)
ja 0x9e4b
movq %r12, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
movapd 0x40d4(%rip), %xmm2     # 0xe050
subpd %xmm2, %xmm1
movq %rcx, %xmm3
punpckldq %xmm4, %xmm3    # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
subpd %xmm2, %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
mulsd 0x4107(%rip), %xmm2     # 0xe0b0
addsd %xmm1, %xmm0
divsd %xmm2, %xmm0
mulsd 0x40ff(%rip), %xmm0     # 0xe0b8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsd 0x40d8(%rip), %xmm0     # 0xe0a8
retq
nop