// File: /workspace/github_cpp_makefile_star2_O1/Konano[P]UselessDatabase/Table.cpp
// Function: Table::findWheres(std::vector<WhereStmt, std::allocator<WhereStmt>>&)
vector<uint> Table::findWheres(vector<WhereStmt> &where) { // preliminary search
    int mx = -1;
    WhereStmt w;
    // uint w_index;
    for (auto it: where) if (it.rvalue_ty == 1) {
        for (uint i = 0; i < index_num; i++) if (index[i].key.size() == it.cols.size()) {
            bool tmp = true;
            for (uint j = 0; j < it.cols.size(); j++) tmp &= (index[i].key[j] == it.cols[j].second);
            if (tmp) {
                Anys data;
                for (auto _it: it.rvalue) data.push_back(_it);
                int nums = index[i].queryRecordsNum(it.op, data);
                if (nums > mx) {
                    mx = nums;
                    w = it;
                    // w_index = i;
                }
            }
        }
    }

    // FIXME
    // if (mx == -1) {
        return existentRecords();
    // } else {
    //     Anys data;
    //     for (auto it: w.rvalue) data.push_back(it);
    //     return index[w_index].queryRecords(w.op, data);           
    // }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %r12
movq %rdi, 0x18(%rsp)
xorps %xmm0, %xmm0
leaq 0xe8(%rsp), %rax
movaps %xmm0, -0x28(%rax)
movq $0x0, -0x18(%rax)
movw $0x0, -0xc(%rax)
movl $0x0, -0x8(%rax)
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq (%rdx), %rbx
movq 0x8(%rdx), %rax
movq %rax, 0x80(%rsp)
cmpq %rax, %rbx
je 0x26b1d
leaq 0x7a0(%r12), %r13
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
leaq 0xa0(%rsp), %r14
movq %r12, 0x98(%rsp)
movq %r13, 0x90(%rsp)
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0xa91e
movl 0x20(%rbx), %eax
leaq 0x38(%rsp), %rcx
movl %eax, 0x8(%rcx)
movq 0x18(%rbx), %rax
movq %rax, (%rcx)
leaq 0x28(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0xa450
leaq 0x40(%rbx), %rsi
leaq 0x60(%rsp), %rdi
callq 0xa91e
movl 0x58(%rbx), %eax
movl %eax, 0x78(%rsp)
cmpl $0x1, 0x40(%rsp)
movq %rbx, 0x88(%rsp)
jne 0x26acb
cmpl $0x0, 0x798(%r12)
je 0x26acb
xorl %r15d, %r15d
imulq $0x98, %r15, %rbx
movq 0x30(%r13,%rbx), %rax
movq 0x38(%r13,%rbx), %rdi
subq %rax, %rdi
sarq $0x2, %rdi
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rsi
movq %rsi, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rdx, %rdi
jne 0x26ab7
cmpq %rcx, %rsi
je 0x269a0
movb $0x1, %sil
xorl %edi, %edi
movl (%rax,%rdi,4), %r8d
cmpl 0x4(%rcx,%rdi,8), %r8d
sete %r8b
andb %r8b, %sil
incq %rdi
movl %edi, %r8d
cmpq %r8, %rdx
ja 0x2697c
testb %sil, %sil
je 0x26ab7
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movq 0x48(%rsp), %r12
movq 0x50(%rsp), %rbp
cmpq %rbp, %r12
je 0x26a27
movq (%r12), %rdi
testq %rdi, %rdi
je 0x269da
movq (%rdi), %rax
callq *0x10(%rax)
movq %rax, %r13
jmp 0x269dd
xorl %r13d, %r13d
testq %r13, %r13
je 0x269ee
movq (%r13), %rax
movq %r13, %rdi
callq *0x10(%rax)
jmp 0x269f0
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0xa1bc
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x26a12
movq (%rdi), %rax
callq *0x8(%rax)
testq %r13, %r13
je 0x26a21
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
addq $0x8, %r12
jmp 0x269c1
movq 0x90(%rsp), %r13
addq %r13, %rbx
movl 0x38(%rsp), %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1cc46
movq 0x98(%rsp), %r12
movl %eax, %ebx
cmpl 0xc(%rsp), %eax
jle 0x26aaf
leaq 0xc0(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x29094
leaq 0x38(%rsp), %rcx
movl 0x8(%rcx), %eax
leaq 0xd8(%rsp), %rdx
movl %eax, 0x8(%rdx)
movq (%rcx), %rax
movq %rax, (%rdx)
leaq 0xe8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1cefe
leaq 0x100(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x29094
movl 0x78(%rsp), %eax
movl %eax, 0x118(%rsp)
movl %ebx, 0xc(%rsp)
movq %r14, %rdi
callq 0xa564
incq %r15
movl 0x798(%r12), %eax
cmpq %rax, %r15
jb 0x2693d
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x26ae2
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
leaq 0x48(%rsp), %rdi
callq 0xa564
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
movq 0x88(%rsp), %rbx
je 0x26b0b
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
addq $0x60, %rbx
cmpq 0x80(%rsp), %rbx
jne 0x268d6
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x26770
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x26b47
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
leaq 0xe8(%rsp), %rdi
callq 0xa564
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x26b71
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
movq 0x18(%rsp), %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x26b8a
movq %rax, %rbx
jmp 0x26bff
movq %rax, %rbx
jmp 0x26ba1
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xa564
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x26bff
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
jmp 0x26bff
jmp 0x26bc1
movq %rax, %rbx
jmp 0x26bd9
movq %rax, %rbx
jmp 0x26be8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x26bd9
movq (%rdi), %rax
callq *0x8(%rax)
testq %r13, %r13
je 0x26be8
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
leaq 0xa0(%rsp), %rdi
callq 0xa564
leaq 0x20(%rsp), %rdi
callq 0x9cb2
leaq 0xc0(%rsp), %rdi
callq 0x9cb2
movq %rbx, %rdi
callq 0x56e0