// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, -0x30(%rbp)
movq %rdi, %rbx
movl 0x48(%rdi), %edx
movq %rsp, %rcx
leaq 0xf(,%rdx,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x40(%rbp)
movq %rcx, %rsp
xorl %r14d, %r14d
pushq $0x10
popq %r15
xorl %r13d, %r13d
movslq %edx, %rax
cmpq %rax, %r13
jge 0x8aac
movq %r15, %rdi
callq 0x21e0
movq %rax, %r12
movq 0x40(%rbx), %rsi
addq %r14, %rsi
movq %rax, %rdi
callq 0x8a0c
movq -0x40(%rbp), %rax
movq %r12, (%rax,%r13,8)
incq %r13
movl 0x48(%rbx), %edx
addq $0x38, %r14
jmp 0x8a76
movq %rdx, -0x50(%rbp)
movslq 0x4c(%rbx), %rcx
movq -0x30(%rbp), %r14
movq %r14, %rax
xorl %edx, %edx
divq %rcx
incl %eax
movl %eax, 0x48(%rbx)
movq %rbx, -0x58(%rbp)
movq 0x40(%rbx), %rax
movq %rax, -0x48(%rbp)
pushq $0x28
popq %rcx
movq %r14, %rax
mulq %rcx
pushq $-0x1
popq %rcx
cmovoq %rcx, %rax
movq %rax, %rdi
callq 0x2030
testq %r14, %r14
je 0x8b0a
imulq $0x28, -0x30(%rbp), %rdx
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
addq $0x28, %rcx
cmpq %rcx, %rdx
jne 0x8af8
movq %rax, -0x38(%rbp)
xorl %r14d, %r14d
pushq $0x20
popq %rbx
xorl %r13d, %r13d
movq -0x58(%rbp), %r12
cmpq %r13, 0x10(%r12)
jbe 0x8ba7
movq 0x18(%r12), %r15
addq %r14, %r15
movq %r15, %rdi
leaq 0xb7a8(%rip), %rsi      # 0x142e0
movq %rbx, %rdx
callq 0x2200
testl %eax, %eax
je 0x8b9b
movl $0xc70697, %edx         # imm = 0xC70697
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2040
xorl %edx, %edx
movq -0x30(%rbp), %rcx
divq %rcx
movq %r12, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
movq -0x38(%rbp), %r15
movq %r15, %rcx
callq 0x8cf4
imulq $0x28, %rax, %rax
movq 0x18(%r12), %rcx
movups (%rcx,%r14), %xmm0
movups 0x10(%rcx,%r14), %xmm1
movups %xmm0, (%r15,%rax)
movups %xmm1, 0x10(%r15,%rax)
movq 0x20(%rcx,%r14), %rcx
movq %rcx, 0x20(%r15,%rax)
incq %r13
addq $0x28, %r14
jmp 0x8b1b
movl 0x48(%r12), %eax
movslq %eax, %r14
pushq $0x38
popq %r13
movq %r14, %rax
mulq %r13
movq %rax, %r15
pushq $-0x1
popq %rdi
cmovnoq %rax, %rdi
callq 0x2030
movq %rax, %rcx
testl %r14d, %r14d
movq %r12, %rbx
je 0x8bf9
addq $-0x38, %r15
movq %r15, %rax
xorl %edx, %edx
divq %r13
subq %rdx, %r15
addq $0x38, %r15
movq %rcx, %r14
movq %rcx, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20e0
movq %r14, %rcx
movq %rcx, 0x40(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x10(%rbx)
xorl %r15d, %r15d
movq -0x50(%rbp), %rax
testl %eax, %eax
cmovlel %r15d, %eax
movq -0x38(%rbp), %rcx
movq %rcx, 0x18(%rbx)
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
pushq $0x10
popq %rbx
cmpq %r15, %r12
je 0x8c51
movq -0x40(%rbp), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x8c41
movq %r14, %rdi
callq 0x8a22
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21f0
incq %r15
jmp 0x8c27
movq -0x48(%rbp), %rdi
leaq -0x28(%rbp), %rsp
testq %rdi, %rdi
je 0x8c6d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r12, %rdi
callq 0x21f0
movq %rbx, %rdi
callq 0x2340