// File: /workspace/github_cpp_makefile_star2_O2/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, -0x58(%rbp)
movq %rdi, %r14
leaq -0x1090(%rbp), %rdi
callq 0xa130
leaq -0xb8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0xe40(%rbp), %r13
leaq -0x1080(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x2060(%rbp), %rbx
cmpb $0x0, -0x1090(%rbp)
jne 0x9210
movq %r13, %r12
leaq -0x1080(%rbp), %r15
xorl %r13d, %r13d
movslq -0x108c(%rbp), %rax
cmpq %rax, %r13
jge 0x91a7
movq %r12, %rdi
movq %r14, %rsi
callq 0xfd84
testb %al, %al
je 0x91a7
incq %r13
addq $0x8, %r15
addq $0x30, %r12
jmp 0x917f
movq -0x1088(%rbp), %r12
leaq -0xc0(%rbp), %rdi
movq %r15, %rsi
callq 0xa274
movq %r12, (%rax)
movq (%r15), %rdx
movq 0x1014e(%rip), %rdi     # 0x19318
leaq 0x1014f(%rip), %rsi     # 0x19320
callq 0x7a04
movl $0xfd0, %edx            # imm = 0xFD0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3160
movq %rbx, %rdi
callq 0xa130
leaq -0x1090(%rbp), %rdi
movq %rbx, %rsi
callq 0xa4dc
movq %rbx, %rdi
callq 0xa218
leaq -0xe40(%rbp), %r13
jmp 0x9165
cmpl $0x46, -0x108c(%rbp)
jl 0x941b
leaq -0x2060(%rbp), %rdi
callq 0x8b36
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
xorl %ebx, %ebx
leaq -0x90(%rbp), %r12
movq %r13, -0x48(%rbp)
leaq -0x1080(%rbp), %r15
movslq -0x108c(%rbp), %rax
cmpq %rax, %rbx
jge 0x928b
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xa5a8
leaq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0xa75c
leaq -0x88(%rbp), %rdi
callq 0x34f8
incq %rbx
addq $0x8, %r15
addq $0x30, %r13
jmp 0x924c
movq -0x40(%rbp), %rbx
cmpq -0x38(%rbp), %rbx
je 0x92aa
movq %r14, %rdi
movq %rbx, %rsi
callq 0xfc28
testb %al, %al
je 0x92aa
addq $0x38, %rbx
jmp 0x928f
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x5e98
leaq -0x90(%rbp), %rdx
movq -0x58(%rbp), %rax
movq %rax, 0x30(%rdx)
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0xb480
leaq -0x88(%rbp), %rdi
callq 0x34f8
movq -0xe48(%rbp), %rax
leaq -0x1e10(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq -0x248(%rdi), %rax
movq %rax, -0xe48(%rbp)
movl $0x24, -0x108c(%rbp)
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rcx
movq %rcx, %rax
subq %rsi, %rax
pushq $0x38
popq %r8
cqto
idivq %r8
addl $-0x24, %eax
movl %eax, -0x24c(%rdi)
leaq -0x2170(%rbp), %r15
leaq -0x24d0(%rbp), %r12
xorl %r13d, %r13d
xorl %ebx, %ebx
subq %rsi, %rcx
movq %rcx, %rax
cqto
pushq $0x38
popq %rcx
idivq %rcx
cmpq %rax, %rbx
jae 0x93a7
addq %r13, %rsi
cmpq $0x24, %rbx
movq %r12, %rdi
movq -0x48(%rbp), %r14
cmovbq %r14, %rdi
callq 0xa244
cmpq $0x24, %rbx
movq -0x40(%rbp), %rsi
movq 0x30(%rsi,%r13), %rax
movq %r15, %rcx
movq -0x50(%rbp), %rdx
cmovbq %rdx, %rcx
movq %rax, (%rcx)
incq %rbx
movq -0x38(%rbp), %rcx
addq $0x38, %r13
addq $0x8, %r15
addq $0x30, %r12
addq $0x30, %r14
movq %r14, -0x48(%rbp)
addq $0x8, %rdx
movq %rdx, -0x50(%rbp)
jmp 0x933d
leaq -0x4000(%rbp), %rdi
leaq -0x1090(%rbp), %rsi
callq 0xa468
leaq -0x3030(%rbp), %rdi
leaq -0x2060(%rbp), %rsi
callq 0xa468
leaq -0xc0(%rbp), %rdi
leaq -0x4000(%rbp), %rsi
leaq -0x3030(%rbp), %rcx
leaq -0x1e10(%rbp), %rdx
callq 0x8c7c
leaq -0x3030(%rbp), %rdi
callq 0xa218
leaq -0x4000(%rbp), %rdi
callq 0xa218
leaq -0x40(%rbp), %rdi
callq 0xa104
leaq -0x2060(%rbp), %rdi
callq 0xa218
leaq -0xc0(%rbp), %rdi
callq 0xa63e
leaq -0x1090(%rbp), %rdi
callq 0xa218
addq $0x3fd8, %rsp           # imm = 0x3FD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x3030(%rbp), %rdi
callq 0xa218
jmp 0x9459
movq %rax, %rbx
leaq -0x4000(%rbp), %rdi
callq 0xa218
jmp 0x9487
jmp 0x9484
jmp 0x9473
jmp 0x9484
jmp 0x94a2
jmp 0x9484
jmp 0x9484
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x34f8
jmp 0x9487
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0xa104
leaq -0x2060(%rbp), %rdi
callq 0xa218
jmp 0x94a5
jmp 0x94a2
jmp 0x94a2
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0xa63e
leaq -0x1090(%rbp), %rdi
callq 0xa218
movq %rbx, %rdi
callq 0x3450
nop