// File: /workspace/github_cpp_makefile_star2_O3/dvjdjvu[P]bntree/./src/test.cpp
// Function: main
int main()
{
    uint64_t progress = 0;
    uint64_t percent = 0;
    time_point<system_clock> time;
    nanoseconds total_time(0);
    
    write_sequence write =  get_sequence<write_sequence>("./test/write.txt");
    modify_sequence modify =  get_sequence<modify_sequence>("./test/modify.txt");
    read_sequence read = get_sequence<read_sequence>("./test/read.txt");

    bntree st;
    //cout << "count: " << write.size() << endl;
    
    progress = 0;
    percent = write.size() / 100;
    
    for (const string &item : write)
    {
        time = system_clock::now();
        total_time += system_clock::now() - time;
        
        st.insert(item);
        
        if (++progress % (10 * percent) == 0)
        {
            cout << "time: " << duration_cast<milliseconds>(total_time).count()
                 << "ms progress: " << progress << " / " << write.size() << "\n";
        }
    }
    
    cout << "insert have done" << endl;
    
    cout << "\ncount: " << st.size() << " add end" << endl;
    //st.print();
    //return -1;
    
    progress = 0;
    percent = modify.size() / 100;

    modify_sequence::const_iterator mitr = modify.begin();
    read_sequence::const_iterator ritr = read.begin();
    
    for (int i = 0; mitr != modify.end() && ritr != read.end(); ++mitr, ++ritr, i++)
    {
        time = system_clock::now();

        st.erase(mitr->first);
        st.insert(mitr->second);
        
        data_t *d = st.get(ritr->first);
        
        total_time += system_clock::now() - time;
        if (ritr->second != d->key)
        {
            cout << "test failed " << i << endl;
            return 1;
        }

        if (++progress % (10 * percent) == 0)
        {
            cout << "time: " << duration_cast<milliseconds>(total_time).count()
                 << "ms progress: " << progress << " / " << modify.size() << "\n";
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x109b(%rip), %rsi      # 0x402d
leaq 0x10a4(%rip), %rdx      # 0x403d
leaq 0x10(%rsp), %rdi
callq 0x3c2a
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3701
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x2fc1
callq 0x2140
leaq 0x10(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x106e(%rip), %rsi      # 0x403e
leaq 0x1078(%rip), %rdx      # 0x404f
callq 0x3c2a
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x37c2
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ffa
callq 0x2140
leaq 0x10(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1047(%rip), %rsi      # 0x4050
leaq 0x104f(%rip), %rdx      # 0x405f
callq 0x3c2a
leaq 0xa0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x37c2
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x3036
callq 0x2140
leaq 0x10(%rsp), %rdi
callq 0x238c
movq 0x50(%rsp), %r12
movq 0x58(%rsp), %rbx
movabsq $0x28f5c28f5c28f5c3, %rcx # imm = 0x28F5C28F5C28F5C3
cmpq %rbx, %r12
je 0x320b
movq %rbx, %rax
subq %r12, %rax
sarq $0x5, %rax
shrq $0x2, %rax
mulq %rcx
shrq %rdx
andq $-0x2, %rdx
leaq (%rdx,%rdx,4), %rax
movq %rax, (%rsp)
movl $0x1, %r14d
movq $0x0, 0x8(%rsp)
leaq 0xd8(%rsp), %r13
callq 0x2050
movq %rax, %rbp
callq 0x2050
movq %rax, %r15
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x3932
leaq 0xe8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq %r13, %rdi
leaq 0xf3c(%rip), %rdx       # 0x4023
movq %rdx, %rsi
callq 0x3c2a
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0x2586
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x311e
callq 0x2140
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x3138
callq 0x2140
subq %rbp, %r15
addq %r15, 0x8(%rsp)
movq %r14, %rax
xorl %edx, %edx
divq (%rsp)
testq %rdx, %rdx
jne 0x31f9
movl $0x6, %edx
movq 0x2e7a(%rip), %rdi      # 0x5fd8
leaq 0xefb(%rip), %rsi       # 0x4060
callq 0x2190
movq 0x8(%rsp), %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x12, %rdx
addq %rdx, %rsi
movq 0x2e47(%rip), %rdi      # 0x5fd8
callq 0x2150
movq %rax, %r15
movl $0xd, %edx
movq %rax, %rdi
leaq 0xebf(%rip), %rsi       # 0x4067
callq 0x2190
movq %r15, %rdi
movq %r14, %rsi
callq 0x20d0
movq %rax, %r15
movl $0x3, %edx
movq %rax, %rdi
leaq 0xeab(%rip), %rsi       # 0x4075
callq 0x2190
movq 0x58(%rsp), %rsi
subq 0x50(%rsp), %rsi
sarq $0x5, %rsi
movq %r15, %rdi
callq 0x20d0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xe2e(%rip), %rsi       # 0x4022
callq 0x2190
addq $0x20, %r12
incq %r14
cmpq %rbx, %r12
jne 0x3094
jmp 0x3214
movq $0x0, 0x8(%rsp)
movq 0x2dbd(%rip), %r14      # 0x5fd8
leaq 0xe57(%rip), %rsi       # 0x4079
movl $0x10, %edx
movq %r14, %rdi
callq 0x2190
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x2d8b(%rip), %rdi      # 0x5fd8
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x2d77(%rip), %rdi      # 0x5fd8
leaq 0xe22(%rip), %rsi       # 0x408a
movl $0x8, %edx
callq 0x2190
leaq 0x10(%rsp), %rdi
callq 0x2a86
movq 0x2d55(%rip), %rdi      # 0x5fd8
movq %rax, %rsi
callq 0x20d0
movq %rax, %r14
leaq 0xdfe(%rip), %rsi       # 0x4093
movl $0x8, %edx
movq %rax, %rdi
callq 0x2190
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x38(%rsp), %rbp
movq 0x40(%rsp), %rax
xorl %r12d, %r12d
cmpq %rax, %rbp
je 0x35a7
movq 0xa0(%rsp), %rcx
movq %rcx, 0x30(%rsp)
cmpq 0xa8(%rsp), %rcx
je 0x35a7
subq %rbp, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
shrq $0x2, %rax
movabsq $0x28f5c28f5c28f5c3, %rcx # imm = 0x28F5C28F5C28F5C3
mulq %rcx
leaq 0xc8(%rsp), %r13
shrq %rdx
andq $-0x2, %rdx
leaq (%rdx,%rdx,4), %rax
movq %rax, 0x70(%rsp)
addq $0x8, 0x30(%rsp)
xorl %r15d, %r15d
movq $0x0, (%rsp)
movq %rbp, 0x68(%rsp)
callq 0x2050
movq %rax, 0x78(%rsp)
movq (%rbp,%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x2922
leaq (%r15,%rbp), %r14
movq %r13, 0xb8(%rsp)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0x3932
leaq 0x108(%rsp), %r12
movq %r12, 0xf8(%rsp)
leaq 0xf8(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc76(%rip), %rdx       # 0x4023
movq %rdx, %rsi
callq 0x3c2a
leaq 0x10(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2586
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x33dc
callq 0x2140
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
je 0x33ee
callq 0x2140
movq 0x30(%rsp), %r12
leaq (%r12,%r15), %rbx
addq $-0x8, %rbx
movq (%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x2c06
movq %rax, %rbp
callq 0x2050
movq 0x8(%r12,%r15), %rdx
cmpq 0x8(%rbp), %rdx
jne 0x354f
movq %rax, %r13
testq %rdx, %rdx
je 0x3441
movq (%rbp), %rsi
movq 0x30(%rsp), %rax
movq (%rax,%r15), %rdi
callq 0x2180
testl %eax, %eax
jne 0x354f
subq 0x78(%rsp), %r13
addq %r13, 0x8(%rsp)
movq (%rsp), %rax
incq %rax
movq %rax, (%rsp)
xorl %edx, %edx
divq 0x70(%rsp)
testq %rdx, %rdx
jne 0x351c
movl $0x6, %edx
movq 0x2b66(%rip), %rdi      # 0x5fd8
leaq 0xbe7(%rip), %rsi       # 0x4060
callq 0x2190
movq 0x8(%rsp), %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x12, %rdx
addq %rdx, %rsi
movq 0x2b33(%rip), %rdi      # 0x5fd8
callq 0x2150
movq %rax, %r12
movl $0xd, %edx
movq %rax, %rdi
leaq 0xbab(%rip), %rsi       # 0x4067
callq 0x2190
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x20d0
movq %rax, %r12
movl $0x3, %edx
movq %rax, %rdi
leaq 0xb96(%rip), %rsi       # 0x4075
callq 0x2190
movq 0x40(%rsp), %rsi
subq 0x38(%rsp), %rsi
sarq $0x3, %rsi
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rsi
movq %r12, %rdi
callq 0x20d0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb0b(%rip), %rsi       # 0x4022
callq 0x2190
addq $0x28, %r14
xorl %r12d, %r12d
cmpq 0x40(%rsp), %r14
je 0x35a7
addq $0x28, %rbx
addq $0x28, %r15
cmpq 0xa8(%rsp), %rbx
leaq 0xc8(%rsp), %r13
movq 0x68(%rsp), %rbp
jne 0x334e
jmp 0x35a7
movq 0x2a82(%rip), %rdi      # 0x5fd8
leaq 0xb3f(%rip), %rsi       # 0x409c
movl $0xc, %edx
callq 0x2190
movq 0x2a6a(%rip), %rdi      # 0x5fd8
movq (%rsp), %rsi
callq 0x21d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movl $0x1, %r12d
movq %rax, %rdi
callq 0x20e0
leaq 0x10(%rsp), %rdi
callq 0x23a6
leaq 0xa0(%rsp), %rdi
callq 0x389e
leaq 0x38(%rsp), %rdi
callq 0x389e
leaq 0x50(%rsp), %rdi
callq 0x38e8
movl %r12d, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x36d8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x36e5
callq 0x2140
jmp 0x36e5
movq %rax, %rbx
jmp 0x36e5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x36ef
callq 0x2140
jmp 0x36ef
movq %rax, %rbx
jmp 0x36ef
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x36f9
callq 0x2140
jmp 0x36f9
movq %rax, %rbx
jmp 0x36f9
jmp 0x36cb
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3674
callq 0x2140
jmp 0x3674
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x36c2
jmp 0x36ce
jmp 0x36cb
jmp 0x36cb
jmp 0x36cb
jmp 0x36cb
movq %rax, %rbx
jmp 0x36ad
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x36ad
callq 0x2140
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x36ce
callq 0x2140
jmp 0x36ce
jmp 0x36cb
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x23a6
leaq 0xa0(%rsp), %rdi
callq 0x389e
leaq 0x38(%rsp), %rdi
callq 0x389e
leaq 0x50(%rsp), %rdi
callq 0x38e8
movq %rbx, %rdi
callq 0x21e0