// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
movq (%rsi), %rax
movq %rsp, %rsi
movq %rax, (%rsi)
leaq 0x10(%rsp), %r12
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
movq %r12, %rdi
callq 0x9b3a
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq (%r12), %rdi
movq 0x8(%r12), %rax
cmpq %rax, %rdi
je 0x9eb0
movq -0x8(%rax), %rbp
addq $-0x8, %rax
movq %rax, 0x18(%rsp)
testq %rbp, %rbp
je 0x9ea1
cmpb $0x1, 0x8(%rbp)
jne 0x9dd3
cmpl $0x0, 0x4(%rbp)
jle 0x9ea1
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x10(%rbp), %rdi
addq %r13, %rdi
movq %r15, %rsi
callq 0x2050
testl %eax, %eax
js 0x9dbe
movq 0x10(%rbp), %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0x2050
testl %eax, %eax
jg 0x9dbe
movq 0x18(%rbp), %rax
movl 0x8(%rax,%r12,8), %eax
movl %eax, (%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x9db3
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x9dbe
movq %rbx, %rdi
movq %rsp, %rdx
callq 0xa8ee
incq %r12
movslq 0x4(%rbp), %rax
addq $0x20, %r13
cmpq %rax, %r12
jl 0x9d6b
jmp 0x9ea1
movq 0x10(%rbp), %rax
movslq 0x4(%rbp), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x2050
testl %eax, %eax
js 0x9e10
movq 0x18(%rbp), %rax
movslq 0x4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, (%rsp)
leaq 0x10(%rsp), %rdi
movq %rsp, %rsi
callq 0xaa64
movslq 0x4(%rbp), %r12
cmpq $0x2, %r12
jl 0x9e79
leaq 0x1(%r12), %r13
shlq $0x5, %r12
addq $-0x40, %r12
movq 0x10(%rbp), %rax
leaq (%rax,%r12), %rsi
addq $0x20, %rsi
movq %r15, %rdi
callq 0x2050
testl %eax, %eax
jle 0x9e52
movq 0x10(%rbp), %rsi
addq %r12, %rsi
movq %r14, %rdi
callq 0x2050
testl %eax, %eax
js 0x9e6c
movq 0x18(%rbp), %rax
movq -0x10(%rax,%r13,8), %rax
movq %rax, (%rsp)
leaq 0x10(%rsp), %rdi
movq %rsp, %rsi
callq 0xaa64
decq %r13
addq $-0x20, %r12
cmpq $0x2, %r13
ja 0x9e27
movq 0x10(%rbp), %rsi
movq %r15, %rdi
callq 0x2050
testl %eax, %eax
jg 0x9ea1
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
leaq 0x10(%rsp), %rdi
movq %rsp, %rsi
callq 0xaa64
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rax
jmp 0x9d36
testq %rdi, %rdi
je 0x9ec2
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9ee0
jmp 0x9ee0
jmp 0x9f1a
jmp 0x9f1a
jmp 0x9ee0
jmp 0x9f1a
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x9ef7
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x21e0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9f0e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
movq %r14, %rdi
callq 0x22e0
jmp 0x9f1a
jmp 0x9f1a
movq %rax, %rdi
callq 0x4294