// File: /workspace/github_cpp_makefile_star2_O3/chahk0129[P]hash_bench/./index/extendible_hash.h
// Function: Segment<char [32]>::Split()
Segment<Key_t>** Segment<Key_t>::Split(void){
    Segment<Key_t>** split = new Segment<Key_t>*[2];
#ifdef INPLACE
    split[0] = this;
#else
    split[0] = new Segment<Key_t>(local_depth+1);
#endif
    split[1] = new Segment<Key_t>(local_depth+1);

    auto pattern = ((size_t)1 << (sizeof(size_t)*8 - local_depth - 1));
    for (unsigned i = 0; i < kNumSlot; ++i) {
	size_t f_hash;
	if constexpr(sizeof(Key_t) > 8)
	    f_hash = hash_funcs[0](_[i].key, sizeof(Key_t), f_seed);
	else
	    f_hash = hash_funcs[0](&_[i].key, sizeof(Key_t), f_seed);

	if(f_hash & pattern){
	    if(!split[1]->Insert4split(_[i].key, _[i].value, (f_hash & kMask)*kNumPairPerCacheLine)){
#ifdef S_HASH
		size_t s_hash;
		if constexpr(sizeof(Key_t) > 8)
		    s_hash = hash_funcs[2](_[i].key, sizeof(Key_t), s_seed);
		else
		    s_hash = hash_funcs[2](&_[i].key, sizeof(Key_t), s_seed);
		if(!split[1]->Insert4split(_[i].key, _[i].value, (s_hash & kMask)*kNumPairPerCacheLine)){
		    cerr << "[" << __func__ << "]: something wrong -- need to adjust probing distance" << endl;
		}
#else
		cerr << "[" << __func__ << "]: something wrong -- need to adjust probing distance" << endl;
#endif
	    }
	}
#ifndef INPLACE
	else{
	    if(!split[0]->Insert4split(_[i].key, _[i].value, (f_hash & kMask)*kNumPairPerCacheLine)){
#ifdef S_HASH
		size_t s_hash;
		if constexpr(sizeof(Key_t) > 8)
		    s_hash = hash_funcs[2](_[i].key, sizeof(Key_t), s_seed);
		else
		    s_hash = hash_funcs[2](&_[i].key, sizeof(Key_t), s_seed);
		if(!split[0]->Insert4split(_[i].key, _[i].value, (s_hash & kMask)*kNumPairPerCacheLine)){
		    cerr << "[" << __func__ << "]: something wrong -- need to adjust probing distance" << endl;
		}
#else
		cerr << "[" << __func__ << "]: something wrong -- need to adjust probing distance" << endl;
#endif
	    }
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x10, %edi
callq 0x2030
movq %rax, %rbp
movl $0xa040, %edi           # imm = 0xA040
callq 0x21f0
movq %rax, %r15
movq 0xa000(%rbx), %r14
xorl %eax, %eax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15,%rax)
movups %xmm0, (%r15,%rax)
addq $0x28, %rax
cmpq $0xa000, %rax           # imm = 0xA000
jne 0xa091
leaq 0x1(%r14), %r13
movq %r13, 0xa000(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0xa008(%r15)
movups %xmm0, 0xa018(%r15)
movups %xmm0, 0xa028(%r15)
movq $0x0, 0xa038(%r15)
movq %r15, (%rbp)
movl $0xa040, %edi           # imm = 0xA040
callq 0x21f0
xorps %xmm0, %xmm0
movq %rax, %r12
xorl %eax, %eax
movups %xmm0, 0x10(%r12,%rax)
movups %xmm0, (%r12,%rax)
addq $0x28, %rax
cmpq $0xa000, %rax           # imm = 0xA000
jne 0xa0ef
movq %r13, 0xa000(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0xa008(%r12)
movups %xmm0, 0xa018(%r12)
movups %xmm0, 0xa028(%r12)
movq $0x0, 0xa038(%r12)
movq %rbp, 0x8(%rsp)
movq %r12, 0x8(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movl %r14d, %ecx
shrq %cl, %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
movq 0xae89(%rip), %r13      # 0x14fe8
leaq (%rbx,%rbp), %r14
movl $0x20, %esi
movl $0xc70697, %edx         # imm = 0xC70697
movq %r14, %rdi
callq 0x2050
movzbl %al, %ecx
shll $0x2, %ecx
movq 0x20(%rbx,%rbp), %rdx
testq %rax, 0x10(%rsp)
je 0xa18c
movq %r12, %rdi
jmp 0xa18f
movq %r15, %rdi
movq %r14, %rsi
callq 0xa2e4
testb %al, %al
jne 0xa1ff
movl $0x1, %edx
movq %r13, %rdi
leaq 0x4232(%rip), %rsi      # 0xe3dc
callq 0x2210
movl $0x5, %edx
movq %r13, %rdi
leaq 0x4220(%rip), %rsi      # 0xe3de
callq 0x2210
movl $0x35, %edx
movq %r13, %rdi
leaq 0x4212(%rip), %rsi      # 0xe3e4
callq 0x2210
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2120
addq $0x28, %rbp
cmpq $0xa000, %rbp           # imm = 0xA000
jne 0xa15f
movq 0x8(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq