// File: rocket323[P]fishdb/examples/ex_basic.cpp
// Function: main
int main()
{
    const char *fname = "test.fdb";

    auto bt = BTree::Open(fname);
    if (bt == NULL)
    {
        printf("open db[%s] failed", fname);
        return -1;
    }

    std::string val = "hello world";
    bt->Put("greet", val);

    std::string value;
    bt->Get("greet", value);
    std::cout << "greet: " << value << std::endl;

    bt->Close();
    delete bt;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movl $0x0, -0x4(%rbp)
leaq 0xfa5b(%rip), %rax      # 0x12014
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x2380
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
leaq -0x38(%rbp), %rdi
callq 0x22d0
jmp 0x25f1
leaq -0x70(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
leaq -0x71(%rbp), %rsi
callq 0x2850
movq -0xe0(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movl $0x2, %edx
callq 0x3360
movq %rax, -0xd8(%rbp)
jmp 0x2623
leaq -0x70(%rbp), %rdi
callq 0x28e0
leaq -0x38(%rbp), %rdi
callq 0x2140
leaq -0x39(%rbp), %rdi
callq 0x2240
movq -0xd8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x26a8
movq -0x10(%rbp), %rsi
leaq 0xf9c2(%rip), %rdi      # 0x1201d
movb $0x0, %al
callq 0x2050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2818
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x269a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x28e0
leaq -0x38(%rbp), %rdi
callq 0x2140
leaq -0x39(%rbp), %rdi
callq 0x2240
jmp 0x2824
leaq -0x99(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x2380
movq -0xe8(%rbp), %rdx
leaq 0xf967(%rip), %rsi      # 0x12030
leaq -0x98(%rbp), %rdi
callq 0x22d0
jmp 0x26d7
leaq -0x99(%rbp), %rdi
callq 0x2240
movq -0x18(%rbp), %rdi
leaq 0xf94e(%rip), %rsi      # 0x1203c
leaq -0x98(%rbp), %rdx
callq 0x3b10
jmp 0x26fc
leaq -0xc0(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x22f0
movq -0xf0(%rbp), %rdx
movq -0x18(%rbp), %rdi
leaq 0xf91b(%rip), %rsi      # 0x1203c
callq 0x3830
jmp 0x2728
movq 0x188a9(%rip), %rdi     # 0x1afd8
leaq 0xf90c(%rip), %rsi      # 0x12042
callq 0x21d0
movq %rax, -0xf8(%rbp)
jmp 0x2744
movq -0xf8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x21b0
movq %rax, -0x100(%rbp)
jmp 0x2760
movq -0x100(%rbp), %rdi
movq 0x18852(%rip), %rsi     # 0x1afc0
callq 0x2220
jmp 0x2775
movq -0x18(%rbp), %rdi
callq 0x34c0
jmp 0x2780
movq -0x18(%rbp), %rax
movq %rax, -0x108(%rbp)
cmpq $0x0, %rax
je 0x27a9
movq -0x108(%rbp), %rdi
callq 0x2900
movq -0x108(%rbp), %rdi
callq 0x21c0
movl $0x0, -0x4(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x2140
leaq -0x98(%rbp), %rdi
callq 0x2140
jmp 0x2818
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x99(%rbp), %rdi
callq 0x2240
jmp 0x2824
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x280a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x2140
leaq -0x98(%rbp), %rdi
callq 0x2140
jmp 0x2824
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x2370
nopl (%rax)