// File: /workspace/github_cpp_makefile_star2_O2/Konano[P]UselessDatabase/Index.cpp
// Function: Index::queryRecord(Anys*, int)
std::vector<int> Index::queryRecord(Anys* info, int now_index) {
    
    BtreeNode* now = Index::convert_buf_to_BtreeNode(now_index);

    //if((*info)[0].anyCast<int>()!=nullptr)printf("val %d\n",*(*info)[0].anyCast<int>());
    //else printf("\n");

    std::vector<int> v;

    //printf("%d\n",now->record_cnt);

    int l = -1, r = -1, i;
    for (i = 0; i < now->record_cnt; i++) {
        if (now->record[i].key == *info) {
            if (l == -1) l = i;
            r = i;
        }
        else if (now->record[i].key > *info) {
            break;
        }
    }

    if (now->record_cnt > btree_max_per_node) return v;
    
    if (l == -1 && now -> is_leaf) 
        return v;
    else if (l == -1) {
        //Index::convert_BtreeNode_to_buf(now);
        //printf("%d %d %d\n",index, now->child[i],now->record_cnt);
        return Index::queryRecord(info, now->child[i]);
    }

    for (int i = l; i <= r; i++) v.push_back(now -> record[i].record_id);

    if (now -> is_leaf) {
        return v;
    }
    else {
        for (int i = l; i <= r + 1; i++) {
            //Index::convert_BtreeNode_to_buf(now);
            std::vector<int> cv = Index::queryRecord(info, now->child[i]);
            for (uint j = 0; j < cv.size(); j++) v.push_back(cv[j]);
        }
        return v;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbp
movq %rdi, %r14
movq %rsi, 0x8(%rsp)
movq %rsi, %rdi
movl %ecx, %esi
callq 0x1586c
movq %rax, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
pushq $-0x1
popq %r13
pushq $0x8
popq %r15
xorl %ebx, %ebx
movl %r13d, 0x4(%rsp)
movq %r14, 0x30(%rsp)
movq %rbp, 0x38(%rsp)
movslq 0x1c(%r12), %rax
cmpq %rax, %rbx
jge 0x15e4f
movq 0x50(%r12), %rdi
addq %r15, %rdi
movq %rbp, %rsi
callq 0x85ea
testb %al, %al
je 0x15e2d
cmpl $-0x1, %r13d
cmovel %ebx, %r13d
movl %ebx, 0x4(%rsp)
jmp 0x15e41
movq 0x50(%r12), %rdi
addq %r15, %rdi
movq %rbp, %rsi
callq 0x8700
testb %al, %al
jne 0x15e4a
incq %rbx
addq $0x20, %r15
jmp 0x15e01
movl 0x1c(%r12), %eax
movq 0x8(%rsp), %rcx
cmpl 0x90(%rcx), %eax
jg 0x15f19
cmpl $-0x1, %r13d
je 0x15f11
movslq %r13d, %r14
movslq 0x4(%rsp), %r15
movq %r14, %rbx
shlq $0x5, %rbx
leaq 0x10(%rsp), %rbp
movq %r14, %r13
cmpq %r15, %r13
jg 0x15e9f
movq 0x50(%r12), %rsi
addq %rbx, %rsi
movq %rbp, %rdi
callq 0x180fe
incq %r13
addq $0x20, %rbx
jmp 0x15e81
cmpb $0x0, 0x68(%r12)
jne 0x15f19
movl 0x4(%rsp), %eax
incl %eax
movslq %eax, %r15
leaq 0x40(%rsp), %r13
leaq 0x10(%rsp), %rbp
cmpq %r15, %r14
jg 0x15f19
movq 0x20(%r12), %rax
movl (%rax,%r14,4), %ecx
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x15db4
xorl %ebx, %ebx
movl %ebx, %ebx
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0x15f04
leaq (%rax,%rbx,4), %rsi
movq %rbp, %rdi
callq 0x180fe
incl %ebx
jmp 0x15edc
movq %r13, %rdi
callq 0x8c8c
incq %r14
jmp 0x15eba
cmpb $0x0, 0x68(%r12)
je 0x15f59
movaps 0x10(%rsp), %xmm0
movq 0x30(%rsp), %rbx
movups %xmm0, (%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x8c8c
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%r12), %rax
movl (%rax,%rbx,4), %ecx
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x15db4
jmp 0x15f3d
jmp 0x15f80
jmp 0x15f80
jmp 0x15f80
movq %rax, %rbx
jmp 0x15f92
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x8c8c
leaq 0x10(%rsp), %rdi
callq 0x8c8c
movq %rbx, %rdi
callq 0x56f0