// File: chahk0129[P]hash_bench/./index/linear_probing.h
// Function: LinearProbingHash<char [32]>::resize(unsigned long)
void LinearProbingHash<Key_t>::resize(size_t _capacity){
    unique_lock<shared_mutex>* lock[nlocks];
    for(int i=0; i<nlocks; i++){
	lock[i] = new unique_lock<shared_mutex>(mutex[i]);
    }
    int prev_nlocks = nlocks;
    nlocks = _capacity / locksize + 1;
    shared_mutex* old_mutex = mutex;

    Pair<Key_t>* new_dict = new Pair<Key_t>[_capacity];
    for(int i=0; i<capacity; i++){
	if constexpr(sizeof(Key_t) > 8){
	    if(memcmp(dict[i].key, INVALID<Key_t>, sizeof(Key_t)) != 0){
		auto key_hash = h(dict[i].key, sizeof(Key_t)) % _capacity;
		auto loc = getLocation(key_hash, _capacity, new_dict);
		memcpy(&new_dict[loc], &dict[i], sizeof(Pair<Key_t>));
	    }
	}
	else{
	    if(memcmp(&dict[i].key, &INVALID<Key_t>, sizeof(Key_t)) != 0){
		auto key_hash = h(&dict[i].key, sizeof(Key_t)) % _capacity;
		auto loc = getLocation(key_hash, _capacity, new_dict);
		memcpy(&new_dict[loc], &dict[i], sizeof(Pair<Key_t>));
	    }
	}
    }
    mutex = new shared_mutex[nlocks];
    old_cap = capacity;
    old_dic = dict;
    capacity = _capacity;
    dict = new_dict;
    auto tmp = old_dic;
    old_cap = 0;
    old_dic = nullptr;
    for(int i=0; i<prev_nlocks; i++){
	delete lock[i];
    }
    delete[] old_mutex;
    //delete[] tmp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movl 0x48(%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x18(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x78(%rbp)
movq %rcx, %rsp
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x80(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x48(%rcx), %eax
jge 0x1ded6
movl $0x10, %edi
callq 0x6420
movq %rax, %rdi
movq -0x80(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x88(%rbp)
movq 0x40(%rax), %rsi
movslq -0x24(%rbp), %rax
imulq $0x38, %rax, %rax
addq %rax, %rsi
callq 0x1dd90
jmp 0x1de96
movq -0x78(%rbp), %rax
movq -0x88(%rbp), %rdx
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1de59
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x10, %esi
callq 0x6430
jmp 0x1e200
movq -0x80(%rbp), %rcx
movl 0x48(%rcx), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq 0x4c(%rcx), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq -0x80(%rbp), %rax
addq $0x1, %rcx
movl %ecx, 0x48(%rax)
movq 0x40(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movl $0x28, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, -0xa0(%rbp)
callq 0x6030
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x90(%rbp)
cmpq $0x0, %rax
je 0x1dfa6
movq -0x90(%rbp), %rax
movq -0x98(%rbp), %rcx
imulq $0x28, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0xb0(%rbp)
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x14ce0
jmp 0x1df88
movq -0xb0(%rbp), %rcx
movq -0xb8(%rbp), %rax
addq $0x28, %rax
cmpq %rcx, %rax
movq %rax, -0xa8(%rbp)
jne 0x1df73
movq -0x90(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x80(%rbp), %rcx
movslq -0x4c(%rbp), %rax
cmpq 0x10(%rcx), %rax
jae 0x1e0a0
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rdi
movslq -0x4c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
leaq 0x3ccbc(%rip), %rsi     # 0x5aca0
movl $0x20, %edx
callq 0x6190
cmpl $0x0, %eax
je 0x1e090
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rdi
movslq -0x4c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
movl $0x20, %esi
movl $0xc70697, %edx         # imm = 0xC70697
callq 0x1dd60
movq -0x80(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x10(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x58(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0x1e320
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq -0x48(%rbp), %rdi
imulq $0x28, -0x60(%rbp), %rcx
addq %rcx, %rdi
movq 0x18(%rax), %rsi
movslq -0x4c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
movl $0x28, %edx
callq 0x6350
jmp 0x1e090
movq -0xa0(%rbp), %rsi
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x6830
jmp 0x1e200
jmp 0x1e092
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1dfb8
movq -0x80(%rbp), %rax
movslq 0x48(%rax), %rax
movq %rax, -0xc8(%rbp)
movl $0x38, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x6030
movq %rax, %rcx
movq -0xc8(%rbp), %rax
movq %rcx, -0xc0(%rbp)
cmpq $0x0, %rax
je 0x1e13e
movq -0xc0(%rbp), %rax
movq -0xc8(%rbp), %rcx
imulq $0x38, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0xd8(%rbp)
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x1cb90
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rcx
addq $0x38, %rax
cmpq %rcx, %rax
movq %rax, -0xd0(%rbp)
jne 0x1e10d
movq -0x80(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq %rcx, 0x40(%rax)
movq 0x10(%rax), %rcx
movq %rcx, 0x20(%rax)
movq 0x18(%rax), %rcx
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq 0x28(%rax), %rcx
movq %rcx, -0x68(%rbp)
movq $0x0, 0x20(%rax)
movq $0x0, 0x28(%rax)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x1e1d7
movq -0x78(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, %rax
je 0x1e1ca
movq -0xe8(%rbp), %rdi
callq 0x1ddd0
movq -0xe8(%rbp), %rdi
movl $0x10, %esi
callq 0x6430
jmp 0x1e1cc
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x1e18c
movq -0x40(%rbp), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, %rax
je 0x1e1f4
movq -0xf0(%rbp), %rdi
callq 0x6540
movq -0x18(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x6780
nopl (%rax)