// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x10, %edi
callq 0x6030
movq %rax, -0x10(%rbp)
movl $0xa040, %edi           # imm = 0xA040
callq 0x6420
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x40(%rbp)
movq 0xa000(%rax), %rsi
incq %rsi
callq 0x1bc40
jmp 0x1cc9b
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0xa040, %edi           # imm = 0xA040
callq 0x6420
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x50(%rbp)
movq 0xa000(%rax), %rsi
incq %rsi
callq 0x1bc40
jmp 0x1cccf
movq -0x48(%rbp), %rax
movq -0x50(%rbp), %rdx
movq -0x10(%rbp), %rcx
movq %rdx, 0x8(%rcx)
movl $0x40, %ecx
subq 0xa000(%rax), %rcx
subq $0x1, %rcx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpq $0x400, %rax            # imm = 0x400
jae 0x1cea0
movq -0x48(%rbp), %rdi
movq 0x3d764(%rip), %rax     # 0x5a480
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rdi
movl $0x20, %esi
movl $0xc70697, %edx         # imm = 0xC70697
callq *%rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
andq -0x28(%rbp), %rax
cmpq $0x0, %rax
je 0x1ce10
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rdi
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
movq %rax, %rsi
addq %rcx, %rsi
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rdx
movq -0x38(%rbp), %rcx
andq $0xff, %rcx
shlq $0x2, %rcx
callq 0x1d2f0
testb $0x1, %al
jne 0x1ce0b
movq 0x3d256(%rip), %rdi     # 0x59fe8
leaq 0x255e3(%rip), %rsi     # 0x4237c
callq 0x6400
movq %rax, %rdi
leaq 0x255d6(%rip), %rsi     # 0x4237e
callq 0x6400
movq %rax, %rdi
leaq 0x255cd(%rip), %rsi     # 0x42384
callq 0x6400
movq %rax, %rdi
movq 0x3d1da(%rip), %rsi     # 0x59fa0
callq 0x6460
jmp 0x1ce0b
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0xa040, %esi           # imm = 0xA040
callq 0x6430
jmp 0x1ceaa
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0xa040, %esi           # imm = 0xA040
callq 0x6430
jmp 0x1ceaa
jmp 0x1ce90
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
movq %rax, %rsi
addq %rcx, %rsi
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rdx
movq -0x38(%rbp), %rcx
andq $0xff, %rcx
shlq $0x2, %rcx
callq 0x1d2f0
testb $0x1, %al
jne 0x1ce8e
movq 0x3d193(%rip), %rdi     # 0x59fe8
leaq 0x25520(%rip), %rsi     # 0x4237c
callq 0x6400
movq %rax, %rdi
leaq 0x25513(%rip), %rsi     # 0x4237e
callq 0x6400
movq %rax, %rdi
leaq 0x2550a(%rip), %rsi     # 0x42384
callq 0x6400
movq %rax, %rdi
movq 0x3d117(%rip), %rsi     # 0x59fa0
callq 0x6460
jmp 0x1ce90
jmp 0x1ce92
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1cd02
movq -0x10(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x6780
nopw %cs:(%rax,%rax)
nopl (%rax)