// File: yangwanyuan[P]HLKVDS/tools/LoadDB.cc
// Function: Open_DB_Test(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Open_DB_Test(string filename) {

    Options opts;
    KVDS *db = KVDS::Open_KVDS(filename.c_str(), opts);

    Iterator* it = db->NewIterator();
    cout << "Iterator the db: First to Last" << endl;
    for(it->SeekToFirst(); it->Valid(); it->Next()) {
        cout << it->Key() << ": " << it->Value() << endl;
    }
    sleep(3);
    cout << "Iterator the db: Last to First" << endl;
    for(it->SeekToLast(); it->Valid(); it->Prev()) {
        cout << it->Key() << ": " << it->Value() << endl;
    }
    delete it;
    delete db;
}

// Assembly:
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdi, 0xa0(%rsp)
movq %rdi, 0x1f0(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0x36550
movq 0xa0(%rsp), %rdi
callq 0x8180
movq %rax, 0xa8(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
movl $0x50, %edx
callq 0x8410
movq 0xa8(%rsp), %rdi
movups 0x188(%rsp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x40(%rax)
movups 0x148(%rsp), %xmm0
movups 0x158(%rsp), %xmm1
movups 0x168(%rsp), %xmm2
movups 0x178(%rsp), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x2add0
movq %rax, 0x198(%rsp)
movq 0x198(%rsp), %rdi
callq 0x2ad60
movq %rax, 0x140(%rsp)
movq 0x671ee(%rip), %rdi     # 0x6ffd0
leaq 0x48242(%rip), %rsi     # 0x5102b
callq 0x84e0
movq %rax, %rdi
movq 0x671a8(%rip), %rsi     # 0x6ffa0
callq 0x8520
movq 0x140(%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x140(%rsp), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
testb $0x1, %al
jne 0x8e22
jmp 0x8f45
movq 0x140(%rsp), %rsi
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq 0x120(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq *%rax
movq 0x90(%rsp), %rsi
movq 0x6717e(%rip), %rdi     # 0x6ffd0
callq 0x8470
movq %rax, 0x98(%rsp)
jmp 0x8e61
movq 0x98(%rsp), %rdi
leaq 0x48d7a(%rip), %rsi     # 0x51bea
callq 0x84e0
movq %rax, 0x88(%rsp)
jmp 0x8e7f
movq 0x140(%rsp), %rsi
movq (%rsi), %rax
movq 0x40(%rax), %rax
leaq 0xf0(%rsp), %rdi
callq *%rax
jmp 0x8e9a
movq 0x88(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x8470
movq %rax, 0x80(%rsp)
jmp 0x8eb9
movq 0x80(%rsp), %rdi
movq 0x670d8(%rip), %rsi     # 0x6ffa0
callq 0x8520
jmp 0x8ecf
leaq 0xf0(%rsp), %rdi
callq 0x8928
leaq 0x120(%rsp), %rdi
callq 0x8928
movq 0x140(%rsp), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
jmp 0x8e0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x8f33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x8928
leaq 0x120(%rsp), %rdi
callq 0x8928
jmp 0x90e2
movl $0x3, %edi
callq 0x83c0
movq 0x6707a(%rip), %rdi     # 0x6ffd0
leaq 0x480ed(%rip), %rsi     # 0x5104a
callq 0x84e0
movq %rax, %rdi
movq 0x67034(%rip), %rsi     # 0x6ffa0
callq 0x8520
movq 0x140(%rsp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x140(%rsp), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
testb $0x1, %al
jne 0x8f96
jmp 0x909e
movq 0x140(%rsp), %rsi
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq 0xd0(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq *%rax
movq 0x70(%rsp), %rsi
movq 0x67010(%rip), %rdi     # 0x6ffd0
callq 0x8470
movq %rax, 0x78(%rsp)
jmp 0x8fcc
movq 0x78(%rsp), %rdi
leaq 0x48c12(%rip), %rsi     # 0x51bea
callq 0x84e0
movq %rax, 0x68(%rsp)
jmp 0x8fe4
movq 0x140(%rsp), %rsi
movq (%rsi), %rax
movq 0x40(%rax), %rax
leaq 0xb0(%rsp), %rdi
callq *%rax
jmp 0x8fff
movq 0x68(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x8470
movq %rax, 0x60(%rsp)
jmp 0x9018
movq 0x60(%rsp), %rdi
movq 0x66f7c(%rip), %rsi     # 0x6ffa0
callq 0x8520
jmp 0x902b
leaq 0xb0(%rsp), %rdi
callq 0x8928
leaq 0xd0(%rsp), %rdi
callq 0x8928
movq 0x140(%rsp), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
jmp 0x8f7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x908f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x8928
leaq 0xd0(%rsp), %rdi
callq 0x8928
jmp 0x90e2
movq 0x140(%rsp), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, %rax
je 0x90bc
movq 0x58(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x198(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
je 0x90da
movq 0x50(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x1f8, %rsp            # imm = 0x1F8
retq
movq 0x118(%rsp), %rdi
callq 0x8820
nop