// File: /workspace/github_cpp_makefile_star2_O3/zimpha[P]MiniSQL/indexManager.cc
// Function: BT::insert(element const&, long)
void insert(const element &e, long offset) {
        auto go = [&] (long off) { return blockToNode(*(bfm->BufferManagerRead(name, off))); };
        BTNode c;//s
        map <long, long> parent;
        while (!c.isLeaf) {
            int i = 0;
            while (i < c.n && c.value[i] <= e) i++;
            parent[c.ch[i]] = c.offset;
            c = go(c.ch[i]);
        }
        if (c.n < SZ - 1) {
            //BT::insert_in_leaf(c, e, offset);
        } else { // split
            BTNode p = BT::newNode();
            vector < pair <element, long> > v;
            for (int i = 0; i < c.n; i++) v.push_back(make_pair(c.value[i], c.ch[i]));
            auto it = v.begin();
            while (it != v.end() && e < it->first) it++;
            v.insert(it, make_pair(e, offset));
            int m = (SZ + 1) / 2;
            p.ch[SZ] = c.ch[SZ];
            c.ch[SZ] = p.offset;
            c.n = m;
            p.n = v.size() - m;
            for (size_t i = 0; i < v.size(); i++) {
                (i < m ? c.value[i] : p.value[i - m]) = v[i].first;
                (i < m ? c.ch[i]    : p.ch[i - m]   ) = v[i].second;
            }
            BT::insertParent(parent, c, p.value[0], p);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3fd8, %rsp           # imm = 0x3FD8
movq %rsi, %rbx
movq %rdi, %r14
leaq -0xe50(%rbp), %r15
xorl %r12d, %r12d
leaq 0x18(%r15), %rdi
callq 0x13296
addq $-0x30, %r12
addq $0x30, %r15
cmpq $-0xd80, %r12           # imm = 0xF280
jne 0xb304
movq %rbx, -0x48(%rbp)
leaq -0xb0(%rbp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
cmpb $0x0, -0x1088(%rbp)
jne 0xb482
leaq -0x10a0(%rbp), %rbx
movl $0x258, %r12d           # imm = 0x258
movq %r14, -0x50(%rbp)
cmpl $0x0, -0x1084(%rbp)
jle 0xb399
leaq -0xe38(%rbp), %r15
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
callq 0x13580
testb %al, %al
je 0xb394
incq %r13
movslq -0x1084(%rbp), %rax
addq $0x30, %r15
cmpq %rax, %r13
jl 0xb372
movl %r13d, %eax
jmp 0xb39b
xorl %eax, %eax
movq -0x1080(%rbp), %r13
leaq -0xe38(%rbp), %rcx
leaq (%rcx,%rax,8), %r15
addq $-0x240, %r15           # imm = 0xFDC0
leaq -0xb8(%rbp), %rdi
movq %r15, %rsi
callq 0xca6e
movq %r13, (%rax)
movq (%r15), %rdx
movq 0xff58(%rip), %rdi      # 0x1b328
leaq 0xff59(%rip), %rsi      # 0x1b330
callq 0x94d8
leaq -0x2058(%rbp), %r14
movq %r14, %rdi
callq 0xa76d
movl $0x250, %edx            # imm = 0x250
leaq -0x1088(%rbp), %rdi
movq %r14, %rsi
callq 0x3210
xorl %r15d, %r15d
leaq (%r15,%rbp), %r13
addq $-0x1088, %r13          # imm = 0xEF78
leaq -0x2058(%rbp,%r15), %r14
movq 0x250(%r14), %rax
movq %rax, 0x250(%r13)
leaq (%r12,%r13), %rdi
leaq (%r14,%r12), %rsi
callq 0x3340
movl 0x278(%r14), %eax
movl %eax, 0x278(%r13)
addq $0x30, %r15
cmpq $0xd80, %r15            # imm = 0xD80
jne 0xb402
xorl %r15d, %r15d
movq -0x50(%rbp), %r14
movq -0x10b0(%rbp,%r15), %rdi
leaq (%rbx,%r15), %rax
cmpq %rdi, %rax
je 0xb468
callq 0x3270
addq $-0x30, %r15
cmpq $-0xd80, %r15           # imm = 0xF280
jne 0xb452
cmpb $0x0, -0x1088(%rbp)
je 0xb35f
cmpl $0x46, -0x1084(%rbp)
jl 0xb83e
leaq -0x2058(%rbp), %rdi
callq 0xa8be
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
cmpl $0x0, -0x1084(%rbp)
jle 0xb553
leaq -0xe38(%rbp), %rbx
xorl %r13d, %r13d
leaq -0x40(%rbp), %r15
leaq -0x88(%rbp), %r12
movq (%rbx), %rax
movq %rax, -0x88(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %rdi
callq 0x88b4
movl 0x28(%rbx), %eax
movl %eax, -0x60(%rbp)
movq -0x1078(%rbp,%r13,8), %rax
movq %rax, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xce36
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xb521
callq 0x3270
incq %r13
movslq -0x1084(%rbp), %rax
addq $0x30, %rbx
cmpq %rax, %r13
jl 0xb4cc
movq -0x40(%rbp), %rbx
cmpq -0x38(%rbp), %rbx
je 0xb555
movq %r14, %rdi
movq %rbx, %rsi
callq 0x133ee
testb %al, %al
je 0xb555
addq $0x38, %rbx
jmp 0xb538
xorl %ebx, %ebx
movq (%r14), %rax
leaq -0x80(%rbp), %rdi
movq %rax, -0x8(%rdi)
leaq -0x70(%rbp), %rax
movq %rax, (%rdi)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
callq 0x88b4
movl 0x28(%r14), %eax
leaq -0x88(%rbp), %rdx
movl %eax, 0x28(%rdx)
movq -0x48(%rbp), %rax
movq %rax, 0x30(%rdx)
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0xdb0a
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xb5ab
callq 0x3270
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %rax
movq -0xe40(%rbp), %rcx
movq %rcx, -0x1e10(%rbp)
movq -0x2050(%rbp), %rcx
movq %rcx, -0xe40(%rbp)
movq %rax, %rcx
subq %r12, %rcx
shrq $0x3, %rcx
imull $0xb6db6db7, %ecx, %ecx # imm = 0xB6DB6DB7
addl $-0x24, %ecx
movl $0x24, -0x1084(%rbp)
movl %ecx, -0x2054(%rbp)
cmpq %r12, %rax
je 0xb6ae
leaq -0x1078(%rbp), %rsi
leaq -0xe38(%rbp), %r15
leaq -0x2168(%rbp), %rdi
leaq -0x24c8(%rbp), %r13
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rdi, -0x48(%rbp)
movq %rsi, -0x50(%rbp)
cmpq $0x24, %r14
movq %r13, %rdi
cmovbq %r15, %rdi
leaq (%r12,%rbx), %rsi
addq $0x8, %rsi
movq -0x8(%rsi), %rax
movq %rax, (%rdi)
addq $0x8, %rdi
callq 0x3150
cmpq $0x24, %r14
movl 0x28(%r12,%rbx), %eax
movq %r13, %rcx
cmovbq %r15, %rcx
movl %eax, 0x28(%rcx)
movq -0x40(%rbp), %r12
movq 0x30(%r12,%rbx), %rax
movq -0x48(%rbp), %rdi
movq %rdi, %rcx
movq -0x50(%rbp), %rsi
cmovbq %rsi, %rcx
movq %rax, (%rcx)
incq %r14
movq -0x38(%rbp), %rax
subq %r12, %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
addq $0x8, %rsi
addq $0x30, %r15
addq $0x8, %rdi
addq $0x30, %r13
addq $0x38, %rbx
cmpq %rax, %r14
jb 0xb61c
leaq -0x3ff8(%rbp), %rdi
leaq -0x1088(%rbp), %rsi
movl $0x250, %edx            # imm = 0x250
callq 0x3210
xorl %r14d, %r14d
movq -0xe38(%rbp,%r14), %rax
movq -0xe30(%rbp,%r14), %rsi
leaq (%r14,%rbp), %rdi
addq $-0x3da0, %rdi          # imm = 0xC260
movq %rax, -0x8(%rdi)
leaq (%r14,%rbp), %rax
addq $-0x3d90, %rax          # imm = 0xC270
movq %rax, -0x10(%rax)
movq -0xe28(%rbp,%r14), %rdx
addq %rsi, %rdx
callq 0x88b4
movl -0xe10(%rbp,%r14), %eax
movl %eax, -0x3d80(%rbp,%r14)
addq $0x30, %r14
cmpq $0xd80, %r14            # imm = 0xD80
jne 0xb6c9
leaq -0x3028(%rbp), %rdi
leaq -0x2058(%rbp), %rsi
movl $0x250, %edx            # imm = 0x250
callq 0x3210
leaq -0x1e08(%rbp), %rbx
xorl %r14d, %r14d
movq -0x1e08(%rbp,%r14), %rax
movq -0x1e00(%rbp,%r14), %rsi
leaq (%r14,%rbp), %rdi
addq $-0x2dd0, %rdi          # imm = 0xD230
movq %rax, -0x8(%rdi)
leaq (%r14,%rbp), %rax
addq $-0x2dc0, %rax          # imm = 0xD240
movq %rax, -0x10(%rax)
movq -0x1df8(%rbp,%r14), %rdx
addq %rsi, %rdx
callq 0x88b4
movl -0x1de0(%rbp,%r14), %eax
movl %eax, -0x2db0(%rbp,%r14)
addq $0x30, %r14
cmpq $0xd80, %r14            # imm = 0xD80
jne 0xb745
leaq -0xb8(%rbp), %rdi
leaq -0x3ff8(%rbp), %rsi
leaq -0x3028(%rbp), %rcx
movq %rbx, %rdx
callq 0xaab0
movq $-0xd80, %rbx           # imm = 0xF280
leaq -0x2070(%rbp), %r14
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0xb7d8
callq 0x3270
addq $-0x30, %r14
addq $0x30, %rbx
jne 0xb7ca
movq $-0xd80, %rbx           # imm = 0xF280
leaq -0x3040(%rbp), %r14
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0xb7fe
callq 0x3270
addq $-0x30, %r14
addq $0x30, %rbx
jne 0xb7f0
leaq -0x40(%rbp), %rdi
callq 0xc97e
leaq -0x10a0(%rbp), %rbx
xorl %r14d, %r14d
movq -0x10b0(%rbp,%r14), %rdi
leaq (%rbx,%r14), %rax
cmpq %rdi, %rax
je 0xb831
callq 0x3270
addq $-0x30, %r14
cmpq $-0xd80, %r14           # imm = 0xF280
jne 0xb81b
leaq -0xb8(%rbp), %rdi
callq 0xcda6
leaq -0xd0(%rbp), %rbx
xorl %r14d, %r14d
movq -0xe0(%rbp,%r14), %rdi
leaq (%rbx,%r14), %rax
cmpq %rdi, %rax
je 0xb86a
callq 0x3270
addq $-0x30, %r14
cmpq $-0xd80, %r14           # imm = 0xF280
jne 0xb854
addq $0x3fd8, %rsp           # imm = 0x3FD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x3028(%rbp), %rdi
callq 0x35d8
jmp 0xb900
jmp 0xb8af
jmp 0xb8a7
jmp 0xb9ab
jmp 0xb8a7
jmp 0xb8a7
movq %rax, %rbx
jmp 0xb956
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xb956
callq 0x3270
jmp 0xb956
jmp 0xb9ab
movq %rax, %rbx
testq %r14, %r14
je 0xb900
leaq (%r14,%rbp), %r15
addq $-0x2df0, %r15          # imm = 0xD210
negq %r14
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xb8f6
callq 0x3270
addq $-0x30, %r15
addq $0x30, %r14
jne 0xb8e8
movq $-0xd80, %r14           # imm = 0xF280
leaq -0x3040(%rbp), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xb91c
callq 0x3270
addq $-0x30, %r15
addq $0x30, %r14
jne 0xb90e
jmp 0xb956
movq %rax, %rbx
testq %r14, %r14
je 0xb956
leaq (%r14,%rbp), %r15
addq $-0x3dc0, %r15          # imm = 0xC240
negq %r14
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xb94c
callq 0x3270
addq $-0x30, %r15
addq $0x30, %r14
jne 0xb93e
leaq -0x40(%rbp), %rdi
callq 0xc97e
movq $-0xd80, %r14           # imm = 0xF280
leaq -0x10a0(%rbp), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xb97b
callq 0x3270
addq $-0x30, %r15
addq $0x30, %r14
jne 0xb96d
jmp 0xb9ae
jmp 0xb9ab
movq %rax, %rbx
testq %r12, %r12
je 0xb9e7
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xb99f
callq 0x3270
addq $-0x30, %r15
addq $0x30, %r12
jne 0xb991
jmp 0xb9e7
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0xcda6
leaq -0xd0(%rbp), %r14
xorl %r15d, %r15d
movq -0xe0(%rbp,%r15), %rdi
leaq (%r14,%r15), %rax
cmpq %rdi, %rax
je 0xb9da
callq 0x3270
addq $-0x30, %r15
cmpq $-0xd80, %r15           # imm = 0xF280
jne 0xb9c4
movq %rbx, %rdi
callq 0x3480
nop