// File: chahk0129[P]hash_bench/./bench/benchmark.hpp
// Function: benchmark_t<unsigned long>::utilization(int, Pair<unsigned long>*, int)
inline void benchmark_t<Key_t>::utilization(int index_type, Pair<Key_t>* init_kv, int init_num){
    gen_input(init_kv, init_num);
    std::random_shuffle(init_kv, init_kv+init_num);
    std::vector<int> num_records;
    int base = 0;
    int num_iter = 100;
    for(int i=0; i<num_iter; i++){
	base += 1000;
	num_records.push_back(base);
    }

    std::vector<double> utils;
    for(auto& it: num_records){
	Hash<Key_t>* hashtable = getInstance<Key_t>(index_type);
	for(int i=0; i<it; i++){
	    hashtable->Insert(init_kv[i].key, init_kv[i].value);
	}
	double util = hashtable->Utilization();
	utils.push_back(util);
	delete hashtable;
    }

    for(int i=0; i<num_iter; i++)
	std::cout << utils[i] << std::endl;
	//std::cout << "num( " << num_records[i] << " ), util( " << utils[i] << " %)" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1a5d0
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x1a630
leaq -0x38(%rbp), %rdi
callq 0x25060
movl $0x0, -0x3c(%rbp)
movl $0x64, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x14a3b
movl -0x3c(%rbp), %eax
addl $0x3e8, %eax            # imm = 0x3E8
movl %eax, -0x3c(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x25080
jmp 0x14a1d
jmp 0x14a1f
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x149fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x14c16
leaq -0x70(%rbp), %rdi
callq 0x250f0
leaq -0x38(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0x25110
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
callq 0x25140
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x25170
testb $0x1, %al
jne 0x14a82
jmp 0x14b95
leaq -0x80(%rbp), %rdi
callq 0x251b0
movq %rax, -0x90(%rbp)
movl -0xc(%rbp), %edi
callq 0x1a490
movq %rax, -0xb8(%rbp)
jmp 0x14aa3
movq -0xb8(%rbp), %rax
movq %rax, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq -0x90(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x14b24
movq -0x98(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x9c(%rbp), %rcx
shlq $0x4, %rcx
movq %rax, %rsi
addq %rcx, %rsi
movq 0x8(%rax,%rcx), %rdx
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
jmp 0x14af7
jmp 0x14af9
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x14abb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x25280
jmp 0x14c16
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movsd %xmm0, -0xc0(%rbp)
jmp 0x14b3e
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x251d0
jmp 0x14b60
movq -0x98(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
je 0x14b85
movq -0xc8(%rbp), %rdi
movl $0x8, %esi
callq 0x53c0
jmp 0x14b87
leaq -0x80(%rbp), %rdi
callq 0x25240
jmp 0x14a69
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x14bfb
movslq -0xac(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x25260
movsd (%rax), %xmm0
movq 0x463f3(%rip), %rdi     # 0x5afb8
callq 0x5760
movq %rax, -0xd0(%rbp)
jmp 0x14bd3
movq -0xd0(%rbp), %rdi
movq 0x463bf(%rip), %rsi     # 0x5afa0
callq 0x53f0
jmp 0x14be8
jmp 0x14bea
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x14b9f
leaq -0x70(%rbp), %rdi
callq 0x25280
leaq -0x38(%rbp), %rdi
callq 0x252e0
addq $0xd0, %rsp
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x252e0
movq -0x50(%rbp), %rdi
callq 0x56c0
nopl (%rax,%rax)