// File: BU-DiSC[P]BF-Shared-Hashing/db.cpp
// Function: db::GetFromData(int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool*)
inline string db::GetFromData( int i, int bf_no, int index_pos, string key, bool * result )
{
	vector <string> data_block;
	vector <string> filter;
	string sst_data_filename = data_dir + "level_" + to_string(i) + "-sst_" + to_string(bf_no) + ".txt";

	
	//auto data_start = high_resolution_clock::now();
	read_data( sst_data_filename, index_pos, key.size(), data_block );
	//auto data_end = high_resolution_clock::now();
	//data_duration += duration_cast<microseconds>(data_end - data_start);	
	int found = -1;
	for ( int k=0 ; k<data_block.size() ; k++){
		string data_entry = data_block[k].substr( 0, key.size() );
		if(data_entry.compare(key) == 0){
			found = k;
		}
	}
	if ( found == -1 ){
		*result = false;
		return "";
	}
	else {
		*result = true;
		return key; 
	}
}

// Assembly:
subq $0x1e8, %rsp            # imm = 0x1E8
movq %r9, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
movq %rdi, %rax
movq %rax, 0x40(%rsp)
movq 0x1f0(%rsp), %rax
movq %rdi, 0x1e0(%rsp)
movq %rsi, 0x1d8(%rsp)
movl %edx, 0x1d4(%rsp)
movl %ecx, 0x1d0(%rsp)
movl %r8d, 0x1cc(%rsp)
movq %r9, 0x1c0(%rsp)
movq 0x1d8(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x7a20
leaq 0x190(%rsp), %rdi
callq 0x7a20
movq 0x48(%rsp), %rsi
addq $0x60, %rsi
leaq 0x4f032(%rip), %rdx     # 0x64378
leaq 0xf0(%rsp), %rdi
callq 0x10f60
jmp 0x15355
movl 0x1d4(%rsp), %esi
leaq 0xc0(%rsp), %rdi
callq 0x11a60
jmp 0x1536b
leaq 0x110(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x11970
jmp 0x1538a
leaq 0x4efee(%rip), %rdx     # 0x6437f
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x11740
jmp 0x153a8
movl 0x1d0(%rsp), %esi
leaq 0xa0(%rsp), %rdi
callq 0x11a60
jmp 0x153be
leaq 0x150(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x11970
jmp 0x153dd
leaq 0x4f94d(%rip), %rdx     # 0x64d31
leaq 0x170(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x11740
jmp 0x153fb
leaq 0x150(%rsp), %rdi
callq 0x6340
leaq 0xa0(%rsp), %rdi
callq 0x6340
leaq 0x130(%rsp), %rdi
callq 0x6340
leaq 0x110(%rsp), %rdi
callq 0x6340
leaq 0xc0(%rsp), %rdi
callq 0x6340
leaq 0xf0(%rsp), %rdi
callq 0x6340
leaq 0x80(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x6260
jmp 0x15460
movq 0x30(%rsp), %rdi
movl 0x1cc(%rsp), %eax
movl %eax, 0x2c(%rsp)
callq 0x6390
movq 0x48(%rsp), %rdi
movl 0x2c(%rsp), %edx
movl %eax, %ecx
leaq 0x80(%rsp), %rsi
leaq 0x1a8(%rsp), %r8
callq 0x15bc0
jmp 0x15497
leaq 0x80(%rsp), %rdi
callq 0x6340
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x78(%rsp)
movslq 0x78(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x8020
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x156b4
movslq 0x78(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x8040
movq 0x30(%rsp), %rdi
movq %rax, 0x18(%rsp)
callq 0x6390
movq 0x18(%rsp), %rsi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0x58(%rsp), %rdi
callq 0x6530
jmp 0x15515
movq 0x30(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x6070
movl %eax, 0x14(%rsp)
jmp 0x1552a
movl 0x14(%rsp), %eax
cmpl $0x0, %eax
jne 0x1569a
movl 0x78(%rsp), %eax
movl %eax, 0x7c(%rsp)
jmp 0x1569a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x15784
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x15626
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x15619
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x1560c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x155ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x155f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x6340
leaq 0xa0(%rsp), %rdi
callq 0x6340
leaq 0x130(%rsp), %rdi
callq 0x6340
leaq 0x110(%rsp), %rdi
callq 0x6340
leaq 0xc0(%rsp), %rdi
callq 0x6340
leaq 0xf0(%rsp), %rdi
callq 0x6340
jmp 0x15784
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x15777
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x6340
jmp 0x15777
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x6340
jmp 0x15777
leaq 0x58(%rsp), %rdi
callq 0x6340
movl 0x78(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0x154b4
cmpl $-0x1, 0x7c(%rsp)
jne 0x15721
movq 0x1f0(%rsp), %rax
movb $0x0, (%rax)
leaq 0x57(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x6860
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq 0x4ece4(%rip), %rsi     # 0x643ca
callq 0x66f0
jmp 0x156ed
leaq 0x57(%rsp), %rdi
callq 0x6570
movl $0x1, 0x50(%rsp)
jmp 0x15743
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x57(%rsp), %rdi
callq 0x6570
jmp 0x15777
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movb $0x1, (%rax)
callq 0x6310
movl $0x1, 0x50(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x6340
leaq 0x190(%rsp), %rdi
callq 0x7e60
leaq 0x1a8(%rsp), %rdi
callq 0x7e60
movq 0x40(%rsp), %rax
addq $0x1e8, %rsp            # imm = 0x1E8
retq
leaq 0x170(%rsp), %rdi
callq 0x6340
leaq 0x190(%rsp), %rdi
callq 0x7e60
leaq 0x1a8(%rsp), %rdi
callq 0x7e60
movq 0xe8(%rsp), %rdi
callq 0x6850
nopl (%rax,%rax)