// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x48(%rdi), %edx
movq %rsp, %rcx
leaq 0xf(,%rdx,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x30(%rbp)
movq %rcx, %rsp
testl %edx, %edx
jle 0x9e7a
xorl %r12d, %r12d
xorl %r13d, %r13d
movl $0x10, %edi
callq 0x21f0
movq %rax, %r15
movq 0x40(%rbx), %rax
addq %r12, %rax
movq %rax, (%r15)
movb $0x0, 0x8(%r15)
movq %r15, %rdi
callq 0xa0ba
movb $0x1, 0x8(%r15)
movq -0x30(%rbp), %rax
movq %r15, (%rax,%r13,8)
incq %r13
movslq 0x48(%rbx), %rdx
addq $0x38, %r12
cmpq %rdx, %r13
jl 0x9e39
movq %rdx, -0x40(%rbp)
movslq 0x4c(%rbx), %rcx
movq %r14, %rax
xorl %edx, %edx
divq %rcx
incl %eax
movl %eax, 0x48(%rbx)
movq 0x40(%rbx), %rax
movq %rax, -0x38(%rbp)
movl $0x28, %ecx
movq %r14, %rax
mulq %rcx
movq $-0x1, %rdi
cmovnoq %rax, %rdi
callq 0x2030
movq %rax, %r12
testq %r14, %r14
je 0x9ee2
leaq (,%r14,8), %rax
leaq (%rax,%rax,4), %rax
xorl %ecx, %ecx
pxor %xmm0, %xmm0
movdqu %xmm0, 0x10(%r12,%rcx)
movdqu %xmm0, (%r12,%rcx)
addq $0x28, %rcx
cmpq %rcx, %rax
jne 0x9ecc
cmpq $0x0, 0x10(%rbx)
je 0x9fd9
cmpq $0x1, %r14
movq %r14, %rax
adcq $0x0, %rax
movq %rax, -0x48(%rbp)
xorl %r13d, %r13d
movq 0x18(%rbx), %rax
leaq (,%r13,4), %r15
addq %r13, %r15
movdqu (%rax,%r15,8), %xmm0
movdqu 0x10(%rax,%r15,8), %xmm1
pcmpeqb 0xa3bd(%rip), %xmm1     # 0x142e0
pcmpeqb 0xa3a5(%rip), %xmm0     # 0x142d0
pand %xmm1, %xmm0
pmovmskb %xmm0, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x9fcc
leaq (%rax,%r15,8), %rdi
movl $0x20, %esi
movl $0xc70697, %edx         # imm = 0xC70697
callq 0x2050
movq %rax, %rdx
movq -0x48(%rbp), %rcx
movq %rdx, %rax
xorl %edx, %edx
divq %r14
leaq (%rdx,%rdx,4), %rax
movdqu (%r12,%rax,8), %xmm0
movdqu 0x10(%r12,%rax,8), %xmm1
pcmpeqb 0xa366(%rip), %xmm1     # 0x142e0
pcmpeqb 0xa34e(%rip), %xmm0     # 0x142d0
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x9fa0
incq %rdx
decq %rcx
jne 0x9f59
movq $-0x1, %rdx
leaq (%rdx,%rdx,4), %rax
movq 0x18(%rbx), %rcx
movq 0x20(%rcx,%r15,8), %rdx
movq %rdx, 0x20(%r12,%rax,8)
movdqu (%rcx,%r15,8), %xmm0
movdqu 0x10(%rcx,%r15,8), %xmm1
movdqu %xmm1, 0x10(%r12,%rax,8)
movdqu %xmm0, (%r12,%rax,8)
incq %r13
cmpq %r13, 0x10(%rbx)
ja 0x9eff
movl 0x48(%rbx), %eax
movslq %eax, %r13
movl $0x38, %ecx
movq %r13, %rax
mulq %rcx
movq $-0x1, %rdi
cmovnoq %rax, %rdi
callq 0x2030
movq %rax, %r15
testl %r13d, %r13d
je 0xa02d
imulq $0x38, %r13, %rax
addq $-0x38, %rax
shrq $0x3, %rax
movabsq $0x2492492492492493, %rcx # imm = 0x2492492492492493
mulq %rcx
imulq $0x38, %rdx, %rdx
addq $0x38, %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r15, 0x40(%rbx)
movq %r14, 0x10(%rbx)
movq %r12, 0x18(%rbx)
pxor %xmm0, %xmm0
movdqu %xmm0, 0x20(%rbx)
movq -0x40(%rbp), %rax
testl %eax, %eax
jle 0xa07a
movl %eax, %r14d
xorl %r15d, %r15d
movq -0x30(%rbp), %rax
movq (%rax,%r15,8), %rbx
testq %rbx, %rbx
je 0xa072
movq %rbx, %rdi
callq 0x9de6
movl $0x10, %esi
movq %rbx, %rdi
callq 0x2200
incq %r15
cmpq %r15, %r14
jne 0xa050
movq -0x38(%rbp), %rdi
leaq -0x28(%rbp), %rsp
testq %rdi, %rdi
je 0xa096
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2230
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x10, %esi
movq %r15, %rdi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
nop