// File: /workspace/github_cpp_makefile_star2_O1/BU-DiSC[P]BF-Shared-Hashing/db.cpp
// Function: db::split_keys_sst(int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void db::split_keys_sst(int sst_capacity, vector<string> keys_one_level, vector<vector<string> > & sst, vector<string> & fence_pointer )
{
	sst.clear();
	fence_pointer.clear();
	if(keys_one_level.size() == 0) return;
	sort(keys_one_level.begin(), keys_one_level.end());
	int start_index = 0;
	int num_keys_one_level = keys_one_level.size();
	while(true){
		int end_index = start_index + sst_capacity;
		fence_pointer.push_back(keys_one_level[start_index]);
		if(end_index >= num_keys_one_level){
			sst.push_back(vector<string> (keys_one_level.cbegin() + start_index, keys_one_level.cend()));
			break;
		}else{
			sst.push_back(vector<string> (keys_one_level.cbegin() + start_index, keys_one_level.cbegin() + end_index));
		}
		start_index = end_index;
	}	
	fence_pointer.push_back(keys_one_level.back());	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x10(%rsp)
movq %rdx, %r14
movq %rsi, 0x18(%rsp)
movq (%rcx), %rbx
movq %rcx, 0x8(%rsp)
movq 0x8(%rcx), %r15
cmpq %rbx, %r15
je 0xb389
movq %rbx, %r13
movq %r13, %rdi
callq 0x6982
addq $0x18, %r13
cmpq %r15, %r13
jne 0xb36f
movq 0x8(%rsp), %rax
movq %rbx, 0x8(%rax)
movq 0x10(%rsp), %rdi
callq 0xe08a
movq (%r14), %rbp
movq 0x8(%r14), %r13
movq %r13, %rax
subq %rbp, %rax
je 0xb486
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x10c75
movq %rbp, %rdi
movq %r13, %rsi
callq 0x10d59
movq 0x8(%r14), %r12
subq (%r14), %r12
shrq $0x5, %r12
xorl %r15d, %r15d
leaq 0x20(%rsp), %r13
movq 0x18(%rsp), %rax
leal (%r15,%rax), %ebx
movslq %r15d, %rbp
shlq $0x5, %rbp
movq (%r14), %rsi
addq %rbp, %rsi
movq 0x10(%rsp), %rdi
callq 0x6b72
cmpl %r12d, %ebx
jge 0xb43f
movq (%r14), %rax
addq %rax, %rbp
movslq %ebx, %rdx
shlq $0x5, %rdx
addq %rax, %rdx
movq %r13, %rdi
movq %rbp, %rsi
leaq 0x7(%rsp), %rcx
callq 0xe0d0
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x10796
movq %r13, %rdi
callq 0x6982
movl %ebx, %r15d
jmp 0xb46b
addq (%r14), %rbp
movq 0x8(%r14), %rdx
movq %r13, %rdi
movq %rbp, %rsi
leaq 0x7(%rsp), %rcx
callq 0xe0d0
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x10796
movq %r13, %rdi
callq 0x6982
cmpl %r12d, %ebx
jl 0xb3e0
movq 0x8(%r14), %rsi
addq $-0x20, %rsi
movq 0x10(%rsp), %rdi
callq 0x6b72
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb497
movq %rax, %rbx
jmp 0xb4ab
jmp 0xb49e
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6982
movq %rbx, %rdi
callq 0x56b0
nop