// File: /workspace/github_cpp_makefile_star2_O2/ChaohuiYu[P]BPlusTree/BPlusTree.cpp
// Function: BPlusTree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::rangeQueryValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<int> BPT<T>::rangeQueryValue(T key1, T key2) {
    BPT_NODE* node;
    vector<BPT_NODE*> nodeStack {_root};
    vector<int> queryValues;

    while(!nodeStack.empty()) {
        node = nodeStack.back();
        nodeStack.pop_back();

        if (node == NULL) {
            continue;
        }

        if (!node->_isLeaf) {
            if (key2 >= node->_keys[node->_keyCount - 1]) {
                nodeStack.push_back((BPT_NODE*)node->_pointers[node->_keyCount]);
            }
            for (int i = node->_keyCount - 1; i > 0; i--) {
                if (key1 <= node->_keys[i] || key2 >= node->_keys[i-1]) {
                    nodeStack.push_back((BPT_NODE*)node->_pointers[i]);
                }
            }
            if (key1 <= node->_keys[0]) {
                nodeStack.push_back((BPT_NODE*)node->_pointers[0]);
            }
        }
        else {
            FOR(i, 0, node->_keyCount) {
                if (node->_keys[i] >= key1 && node->_keys[i] <= key2) {
                    queryValues.push_back((int)(long long)node->_pointers[i+1]);
                }
            }
        }
    }
    return queryValues;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
movq (%rsi), %rax
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
leaq 0x20(%rsp), %rdi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
movq %r12, %rsi
callq 0x7d40
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, 0x18(%rsp)
andq $0x0, 0x10(%rbx)
movq 0x28(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0x800e
movq -0x8(%rax), %rbp
addq $-0x8, %rax
movq %rax, 0x28(%rsp)
testq %rbp, %rbp
je 0x7ec2
cmpb $0x1, 0x8(%rbp)
jne 0x7f41
xorl %ebx, %ebx
xorl %r13d, %r13d
movslq 0x4(%rbp), %rax
cmpq %rax, %r13
jge 0x7ec2
movq 0x10(%rbp), %rdi
addq %rbx, %rdi
movq %r15, %rsi
callq 0x8051
testb %al, %al
je 0x7f38
movq 0x10(%rbp), %rdi
addq %rbx, %rdi
movq %r14, %rsi
callq 0x8066
testb %al, %al
je 0x7f38
movq 0x18(%rbp), %rax
movl 0x8(%rax,%r13,8), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x88d2
incq %r13
addq $0x20, %rbx
jmp 0x7eef
movq 0x10(%rbp), %rax
movslq 0x4(%rbp), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x8051
testb %al, %al
je 0x7f7f
movq 0x18(%rbp), %rax
movslq 0x4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x8aba
movl 0x4(%rbp), %ebx
movq %rbx, %r13
shlq $0x5, %r13
addq $-0x40, %r13
movq 0x10(%rbp), %rsi
cmpl $0x1, %ebx
jle 0x7fe0
addq %r13, %rsi
addq $0x20, %rsi
movq %r15, %rdi
callq 0x8066
testb %al, %al
jne 0x7fbc
movq 0x10(%rbp), %rsi
addq %r13, %rsi
movq %r14, %rdi
callq 0x8051
testb %al, %al
je 0x7fd7
movq 0x18(%rbp), %rax
movq -0x8(%rax,%rbx,8), %rax
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x8aba
addq $-0x20, %r13
decq %rbx
jmp 0x7f8d
movq %r15, %rdi
callq 0x8066
testb %al, %al
je 0x7ec2
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x8aba
jmp 0x7ec2
leaq 0x20(%rsp), %rdi
callq 0x8a30
movq 0x18(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8032
jmp 0x8032
jmp 0x8032
movq %rax, %r14
movq 0x18(%rsp), %rdi
callq 0x5b74
leaq 0x20(%rsp), %rdi
callq 0x8a30
movq %r14, %rdi
callq 0x22e0