// File: /workspace/github_cpp_makefile_star2_O1/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 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x107f(%rip), %rsi      # 0x402d
leaq 0x1088(%rip), %rdx      # 0x403d
leaq 0x18(%rsp), %rdi
callq 0x3c68
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x3752
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x2fdd
callq 0x2140
leaq 0x18(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1052(%rip), %rsi      # 0x403e
leaq 0x105c(%rip), %rdx      # 0x404f
callq 0x3c68
leaq 0x40(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x3813
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x3016
callq 0x2140
leaq 0x18(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x102b(%rip), %rsi      # 0x4050
leaq 0x1033(%rip), %rdx      # 0x405f
callq 0x3c68
leaq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x3813
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x3052
callq 0x2140
leaq 0x18(%rsp), %rdi
callq 0x238c
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %r12
movabsq $0x28f5c28f5c28f5c3, %rcx # imm = 0x28F5C28F5C28F5C3
cmpq %r12, %r15
je 0x3225
movq %r12, %rax
subq %r15, %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 0xf8(%rsp), %r13
callq 0x2050
movq %rax, %rbp
callq 0x2050
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x3976
leaq 0x108(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq %r13, %rdi
leaq 0xf22(%rip), %rdx       # 0x4023
movq %rdx, %rsi
callq 0x3c68
leaq 0x18(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0x258e
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x3138
callq 0x2140
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x3152
callq 0x2140
subq %rbp, %rbx
addq %rbx, 0x8(%rsp)
movq %r14, %rax
xorl %edx, %edx
divq (%rsp)
testq %rdx, %rdx
jne 0x3213
movl $0x6, %edx
movq 0x2e60(%rip), %rdi      # 0x5fd8
leaq 0xee1(%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 0x2e2d(%rip), %rdi      # 0x5fd8
callq 0x2150
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0xea5(%rip), %rsi       # 0x4067
callq 0x2190
movq %rbx, %rdi
movq %r14, %rsi
callq 0x20d0
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xe91(%rip), %rsi       # 0x4075
callq 0x2190
movq 0x60(%rsp), %rsi
subq 0x58(%rsp), %rsi
sarq $0x5, %rsi
movq %rbx, %rdi
callq 0x20d0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xe14(%rip), %rsi       # 0x4022
callq 0x2190
addq $0x20, %r15
incq %r14
cmpq %r12, %r15
jne 0x30b0
jmp 0x322e
movq $0x0, 0x8(%rsp)
movq 0x2da3(%rip), %rbx      # 0x5fd8
leaq 0xe3d(%rip), %rsi       # 0x4079
movl $0x10, %edx
movq %rbx, %rdi
callq 0x2190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x2d71(%rip), %rdi      # 0x5fd8
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x2d5d(%rip), %rdi      # 0x5fd8
leaq 0xe08(%rip), %rsi       # 0x408a
movl $0x8, %edx
callq 0x2190
leaq 0x18(%rsp), %rdi
callq 0x2a9a
movq 0x2d3b(%rip), %rdi      # 0x5fd8
movq %rax, %rsi
callq 0x20d0
movq %rax, %rbx
leaq 0xde4(%rip), %rsi       # 0x4093
movl $0x8, %edx
movq %rax, %rdi
callq 0x2190
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x40(%rsp), %r13
xorl %ebx, %ebx
cmpq 0x48(%rsp), %r13
movabsq $0x28f5c28f5c28f5c3, %rcx # imm = 0x28F5C28F5C28F5C3
je 0x35f3
movq 0xa0(%rsp), %rax
movq %rax, (%rsp)
cmpq 0xa8(%rsp), %rax
je 0x35f3
movq 0x48(%rsp), %rax
subq %r13, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rax
shrq $0x2, %rax
mulq %rcx
leaq 0xe8(%rsp), %r15
shrq %rdx
andq $-0x2, %rdx
leaq (%rdx,%rdx,4), %rax
movq %rax, 0x70(%rsp)
addq $0x8, (%rsp)
xorl %r14d, %r14d
movl $0x0, 0x10(%rsp)
movq $0x0, 0x38(%rsp)
movl $0x0, 0x14(%rsp)
movq %r13, 0x78(%rsp)
callq 0x2050
movq %rax, %r12
movq (%r13,%r14), %rsi
leaq 0x18(%rsp), %rdi
callq 0x292a
leaq (%r14,%r13), %rbp
movq %r15, 0xd8(%rsp)
movq 0x8(%rbp), %rsi
movq 0x10(%rbp), %rdx
addq %rsi, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x3976
leaq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rsp)
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc4e(%rip), %rdx       # 0x4023
movq %rdx, %rsi
callq 0x3c68
leaq 0x18(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
movq %rbx, %rdx
callq 0x258e
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x340c
callq 0x2140
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x341e
callq 0x2140
movq (%rsp), %rax
leaq (%rax,%r14), %r15
addq $-0x8, %r15
movq (%r15), %rsi
leaq 0x18(%rsp), %rdi
callq 0x2c1a
movq %rax, %r13
callq 0x2050
movq %rax, %rbx
movq (%rsp), %rax
movq 0x8(%rax,%r14), %rdx
movb $0x1, %al
cmpq 0x8(%r13), %rdx
jne 0x3472
testq %rdx, %rdx
je 0x3470
movq (%r13), %rsi
movq (%rsp), %rax
movq (%rax,%r14), %rdi
callq 0x2180
testl %eax, %eax
setne %al
jmp 0x3472
xorl %eax, %eax
subq %r12, %rbx
addq %rbx, 0x8(%rsp)
testb %al, %al
movl %eax, %r12d
je 0x34e0
movl $0xc, %edx
movq 0x2b4b(%rip), %rdi      # 0x5fd8
leaq 0xc08(%rip), %rsi       # 0x409c
callq 0x2190
movq 0x2b38(%rip), %rdi      # 0x5fd8
movl 0x14(%rsp), %esi
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, 0x10(%rsp)
movq %rax, %rdi
callq 0x20e0
jmp 0x35b4
movq 0x38(%rsp), %rax
incq %rax
movq %rax, 0x38(%rsp)
xorl %edx, %edx
divq 0x70(%rsp)
testq %rdx, %rdx
jne 0x35b4
movl $0x6, %edx
movq 0x2acf(%rip), %rdi      # 0x5fd8
leaq 0xb50(%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 0x2a9c(%rip), %rdi      # 0x5fd8
callq 0x2150
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0xb14(%rip), %rsi       # 0x4067
callq 0x2190
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0x20d0
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xafe(%rip), %rsi       # 0x4075
callq 0x2190
movq 0x48(%rsp), %rsi
subq 0x40(%rsp), %rsi
sarq $0x3, %rsi
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rsi
movq %rbx, %rdi
callq 0x20d0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa73(%rip), %rsi       # 0x4022
callq 0x2190
testb %r12b, %r12b
jne 0x35ef
addq $0x28, %rbp
xorl %ebx, %ebx
cmpq 0x48(%rsp), %rbp
je 0x35f3
incl 0x14(%rsp)
addq $0x28, %r15
addq $0x28, %r14
cmpq 0xa8(%rsp), %r15
leaq 0xe8(%rsp), %r15
movq 0x78(%rsp), %r13
jne 0x3378
jmp 0x35f3
movl 0x10(%rsp), %ebx
leaq 0x18(%rsp), %rdi
callq 0x23a6
leaq 0xa0(%rsp), %rdi
callq 0x38ee
leaq 0x40(%rsp), %rdi
callq 0x38ee
leaq 0x58(%rsp), %rdi
callq 0x3932
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3729
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x3736
callq 0x2140
jmp 0x3736
movq %rax, %rbx
jmp 0x3736
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x3740
callq 0x2140
jmp 0x3740
movq %rax, %rbx
jmp 0x3740
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x374a
callq 0x2140
jmp 0x374a
movq %rax, %rbx
jmp 0x374a
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x36c5
callq 0x2140
jmp 0x36c5
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x3711
jmp 0x371f
jmp 0x371c
jmp 0x371c
jmp 0x371c
movq %rax, %rbx
jmp 0x36fc
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x36fc
callq 0x2140
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x371f
callq 0x2140
jmp 0x371f
jmp 0x371c
jmp 0x371c
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x23a6
leaq 0xa0(%rsp), %rdi
callq 0x38ee
leaq 0x40(%rsp), %rdi
callq 0x38ee
leaq 0x58(%rsp), %rdi
callq 0x3932
movq %rbx, %rdi
callq 0x21e0