// File: zimpha[P]MiniSQL/indexManager.cc
// Function: getRecord(BFM&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Table&, AttrType const&)
vector < pair <element, long> > getRecord(BFM &bfm, const string &dbName, Table &table, const AttrType &attr) {
    IndexManager im(bfm);
    RecordManager rm(bfm,im);
    if (DEBUG) cout << "RecordManagerGetAllOffsets " << dbName << endl;
    set<long> s = rm.RecordManagerGetAllOffsets(dbName, table);
    if (DEBUG) cout << "RecordManagerGetAllOffsets " << dbName << " done." << endl;
    Filter filter;
    vector < pair <element, long> > v;
    if (DEBUG) cout << "getIndexID" << endl;
    int idx = table.getIndexID(attr);
    if (DEBUG) cout << "getIndexID done." << endl;
    if (idx == -1) return v;
    for (long offset : s) {
        if (DEBUG) cout << "Select" << endl;
        vector < vector <element> > res = rm.RecordManagerRecordSelect(dbName, offset, filter, table);
        if (DEBUG) cout << "Select done" << endl;
        if (DEBUG) cout << "push_back" << endl;
        for (vector <element> &u : res) {
            v.push_back(make_pair(u[idx], offset));
        }
        if (DEBUG) cout << "push_back done" << endl;
    }
    return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x1e0(%rbp)
movq %rdi, %rax
movq %rax, -0x1d8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x13370
movq -0x1d0(%rbp), %rdx
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x22a80
jmp 0x11cfd
movq -0x18(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x3130
jmp 0x11d0f
movq -0x20(%rbp), %rcx
leaq -0xd0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x23ca0
jmp 0x11d2f
leaq -0xf0(%rbp), %rdi
callq 0x35b8
leaq -0x108(%rbp), %rdi
callq 0x1d8a0
jmp 0x11d49
movq -0x1e0(%rbp), %rdi
movb $0x0, -0x109(%rbp)
callq 0x14a50
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x244c0
movl %eax, -0x1e4(%rbp)
jmp 0x11d71
movl -0x1e4(%rbp), %eax
movl %eax, -0x110(%rbp)
cmpl $-0x1, -0x110(%rbp)
jne 0x11e04
movb $0x1, -0x109(%rbp)
movl $0x1, -0x114(%rbp)
jmp 0x12009
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12073
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x35b8
jmp 0x12073
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12067
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x1204f
leaq -0xd0(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rdi
callq 0x7e00
movq %rax, -0x128(%rbp)
movq -0x120(%rbp), %rdi
callq 0x7e30
movq %rax, -0x130(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x7fd0
testb $0x1, %al
jne 0x11e54
jmp 0x11ff8
leaq -0x128(%rbp), %rdi
callq 0x8000
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x170(%rbp), %rdi
callq 0x3130
jmp 0x11e7c
movq -0x138(%rbp), %rcx
movq -0x20(%rbp), %r9
leaq -0x150(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x170(%rbp), %rdx
leaq -0x108(%rbp), %r8
callq 0x23850
jmp 0x11eaa
leaq -0x170(%rbp), %rdi
callq 0x35b8
leaq -0x150(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
callq 0xe650
movq %rax, -0x180(%rbp)
movq -0x178(%rbp), %rdi
callq 0xde60
movq %rax, -0x188(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x14a70
testb $0x1, %al
jne 0x11f06
jmp 0x11fcd
leaq -0x180(%rbp), %rdi
callq 0x14ab0
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rdi
movslq -0x110(%rbp), %rsi
callq 0x14b40
movq %rax, %rsi
leaq -0x1c8(%rbp), %rdi
leaq -0x138(%rbp), %rdx
callq 0x14b00
jmp 0x11f44
movq -0x1e0(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x14ad0
jmp 0x11f59
leaq -0x1c8(%rbp), %rdi
callq 0x14b60
leaq -0x180(%rbp), %rdi
callq 0x14b80
jmp 0x11eea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x35b8
jmp 0x1204f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x11fea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x14b60
jmp 0x11fea
leaq -0x150(%rbp), %rdi
callq 0x7b30
leaq -0x128(%rbp), %rdi
callq 0x8110
jmp 0x11e38
leaq -0x150(%rbp), %rdi
callq 0x7b30
jmp 0x1204f
movb $0x1, -0x109(%rbp)
movl $0x1, -0x114(%rbp)
testb $0x1, -0x109(%rbp)
jne 0x1201e
movq -0x1e0(%rbp), %rdi
callq 0x14ba0
leaq -0x108(%rbp), %rdi
callq 0x82c0
leaq -0xd0(%rbp), %rdi
callq 0x7be0
leaq -0x80(%rbp), %rdi
callq 0x13400
movq -0x1d8(%rbp), %rax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq -0x1e0(%rbp), %rdi
callq 0x14ba0
leaq -0x108(%rbp), %rdi
callq 0x82c0
leaq -0xd0(%rbp), %rdi
callq 0x7be0
leaq -0x80(%rbp), %rdi
callq 0x13400
movq -0x98(%rbp), %rdi
callq 0x34f0
nopl (%rax,%rax)