// File: /workspace/github_cpp_makefile_star2_O1/zimpha[P]MiniSQL/RecordManager.cc
// Function: RecordManager::RecordManagerRecordSelect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, long, Filter const&, Table&)
std::vector<std::vector<element> > RecordManager::RecordManagerRecordSelect(std::string dbName, long offset, const Filter & filter, Table & nt)
{
    bufferIter pBlock;
    std::vector<std::vector<element> > queryResut;
    std::vector<element> queryTuple;
    int tupleSize = nt.entrySize + 1;

    pBlock = bm.BufferManagerRead(dbName, offset);
    Block & block = *pBlock;
    int endPoint = getInt(block, BLOCKSIZE - 4);
    int tuple;
    int startPos;
    for (tuple = 0; tuple <= endPoint - tupleSize; tuple += tupleSize) {
        if (block.data[tuple] == 'N')
            continue;
        startPos = tuple + 1;
        queryTuple.clear();
        for (auto attr : nt.attributes) {
            switch (attr.type) {
                case 0:
                    queryTuple.push_back(element(getInt(block, startPos)));
                    startPos += sizeof(int);
                    break;
                case 1:
                    queryTuple.push_back(element(getFloat(block, startPos)));
                    startPos += sizeof(float);
                    break;
                case 2:
                    queryTuple.push_back(element(getString(block, startPos)));
                    startPos += attr.length;//Include +1
                    break;
                default:
                    break;
            }
        }
        if (true == filter.test(queryTuple))
            queryResut.push_back(queryTuple);
    }
    return queryResut;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %r8, -0xa0(%rbp)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movq %rdi, -0x48(%rbp)
movups %xmm0, (%rdi)
movq %rax, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movq %r9, -0xa8(%rbp)
movl (%r9), %ebx
movq (%rsi), %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x9384
movq %rax, %r15
incl %ebx
movl 0x100c(%rax), %eax
subl %ebx, %eax
js 0x12a2f
addq $0x10, %r15
leaq -0x120(%rbp), %r14
movslq %ebx, %rbx
movl %eax, %r12d
xorl %r13d, %r13d
movq %r15, -0x58(%rbp)
movq %rbx, -0x98(%rbp)
movq %r12, -0x90(%rbp)
cmpb $0x4e, (%r15,%r13)
je 0x12a23
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %r15
cmpq %rbx, %r15
je 0x1284c
movq %rbx, %r12
movq 0x8(%r12), %rdi
leaq 0x18(%r12), %rax
cmpq %rdi, %rax
je 0x1283f
callq 0x3270
addq $0x30, %r12
cmpq %r15, %r12
jne 0x1282b
movq %rbx, -0x38(%rbp)
movq %r13, -0x50(%rbp)
movq -0xa8(%rbp), %rax
movq 0x28(%rax), %rbx
movq 0x30(%rax), %rax
movq %rax, -0xb0(%rbp)
cmpq %rax, %rbx
movq -0x58(%rbp), %r15
je 0x129f0
movq -0x50(%rbp), %rax
leal 0x1(%rax), %r13d
movq %r14, -0x130(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x130(%rbp), %rdi
callq 0x8766
movb 0x28(%rbx), %al
movb %al, 0x18(%r14)
movq 0x20(%rbx), %rax
movq %rax, 0x10(%r14)
addq $0x30, %rbx
leaq -0x100(%rbp), %rdi
movq %rbx, %rsi
callq 0xe992
movl -0x110(%rbp), %eax
testl %eax, %eax
je 0x1298a
cmpl $0x1, %eax
je 0x12964
cmpl $0x2, %eax
jne 0x129c2
movq %r15, %rax
movslq %r13d, %r15
addq %rax, %r15
movq %r15, %rdi
callq 0x3110
leaq -0xc0(%rbp), %rcx
movq %rcx, -0xd0(%rbp)
leaq (%rax,%r15), %rdx
leaq -0xd0(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x8800
leaq -0x88(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x131fa
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x1193a
movq -0x58(%rbp), %r15
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x12943
callq 0x3270
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x1295b
callq 0x3270
addl -0x10c(%rbp), %r13d
jmp 0x129c2
movslq %r13d, %rax
movss (%r15,%rax), %xmm0
leaq -0x88(%rbp), %r12
movq %r12, %rdi
callq 0x131aa
leaq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x1193a
jmp 0x129ac
movslq %r13d, %rax
movl (%r15,%rax), %esi
leaq -0x88(%rbp), %r12
movq %r12, %rdi
callq 0x13186
leaq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x1193a
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x129be
callq 0x3270
addl $0x4, %r13d
leaq -0x100(%rbp), %rdi
callq 0x8372
movq -0x130(%rbp), %rdi
cmpq %r14, %rdi
je 0x129df
callq 0x3270
addq $0x30, %rbx
cmpq -0xb0(%rbp), %rbx
jne 0x1287b
movq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xed9a
movq -0x98(%rbp), %rbx
movq -0x90(%rbp), %r12
movq -0x50(%rbp), %r13
testb %al, %al
je 0x12a23
movq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x7a00
addq %rbx, %r13
cmpq %r12, %r13
jle 0x12810
leaq -0x40(%rbp), %rdi
callq 0x889a
movq -0x48(%rbp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12ac0
jmp 0x12ac0
movq %rax, %rbx
jmp 0x12a6c
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x12a6c
callq 0x3270
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
jmp 0x12a92
jmp 0x12a82
jmp 0x12a87
jmp 0x12a82
movq %rax, %rbx
jmp 0x12a9c
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x12a9c
callq 0x3270
leaq -0x130(%rbp), %rdi
callq 0xe618
jmp 0x12ac3
movq %rax, %rbx
movq -0x130(%rbp), %rdi
cmpq %r14, %rdi
je 0x12ac3
callq 0x3270
jmp 0x12ac3
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x889a
movq -0x48(%rbp), %rdi
callq 0x7926
movq %rbx, %rdi
callq 0x3480
nop