// File: /workspace/github_cpp_makefile_star2_O3/zimpha[P]MiniSQL/RecordManager.cc
// Function: RecordManager::RecordManagerRecordDelete(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, long, Filter const&, Table&)
void RecordManager::RecordManagerRecordDelete(std::string dbName, long offset, const Filter & filter, Table & nt)
{
    bufferIter pBlock;
    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)) {
            block.data[tuple] = 'N';
            std::string tableName = dbName.substr(0, dbName.find('.'));
            for (int i = 0; i < nt.attributes.size(); i++) {
                for (auto index : nt.attributes[i].indices) {
                    im.erase(tableName + "." + nt.attributes[i].name, queryTuple[i]);

                }
            }
        }
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rcx, %r14
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movq %r8, -0x40(%rbp)
movl (%r8), %ebx
movq %rdi, -0x108(%rbp)
movq (%rdi), %rdi
movq %rsi, -0xe8(%rbp)
callq 0x94d8
incl %ebx
movl 0x100c(%rax), %ecx
subl %ebx, %ecx
js 0x127c2
addq $0x10, %rax
movslq %ebx, %rdx
movq %rdx, -0x100(%rbp)
movl %ecx, %ecx
movq %rcx, -0xf8(%rbp)
xorl %ecx, %ecx
leaq -0xa0(%rbp), %r13
movq %r14, -0xf0(%rbp)
movq %rax, -0x38(%rbp)
cmpb $0x4e, (%rax,%rcx)
je 0x127ae
movq %rcx, -0x68(%rbp)
movq -0x60(%rbp), %rbx
movq -0x58(%rbp), %r14
cmpq %rbx, %r14
je 0x123bb
movq %rbx, %r15
movq 0x8(%r15), %rdi
leaq 0x18(%r15), %rax
cmpq %rdi, %rax
je 0x123ae
callq 0x3270
addq $0x30, %r15
cmpq %r14, %r15
jne 0x1239c
movq %rbx, -0x58(%rbp)
movq -0x40(%rbp), %rax
movq 0x28(%rax), %r15
movq 0x30(%rax), %rax
movq %rax, -0x70(%rbp)
cmpq %rax, %r15
leaq -0x178(%rbp), %rbx
leaq -0x118(%rbp), %r14
je 0x12555
movq -0x68(%rbp), %rax
incl %eax
movl %eax, -0x30(%rbp)
movq %rbx, -0x188(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %rdi
callq 0x88b4
movb 0x28(%r15), %al
movb %al, 0x18(%rbx)
movq 0x20(%r15), %rax
movq %rax, 0x10(%rbx)
addq $0x30, %r15
leaq -0x158(%rbp), %rdi
movq %r15, %rsi
callq 0xeaa6
movl -0x168(%rbp), %eax
testl %eax, %eax
je 0x124ef
cmpl $0x1, %eax
je 0x124cc
cmpl $0x2, %eax
jne 0x1252a
movslq -0x30(%rbp), %r13
addq -0x38(%rbp), %r13
movq %r13, %rdi
callq 0x3110
movq %r14, -0x128(%rbp)
leaq (%rax,%r13), %rdx
leaq -0x128(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x8952
leaq -0xa0(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x1332c
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x11a94
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x124ad
callq 0x3270
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x124be
callq 0x3270
movl -0x30(%rbp), %eax
addl -0x164(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x1252a
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movss (%rcx,%rax), %xmm0
movq %r13, %rdi
callq 0x132dc
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x11a94
jmp 0x1250e
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rcx,%rax), %esi
movq %r13, %rdi
callq 0x132b8
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x11a94
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x12526
callq 0x3270
addl $0x4, -0x30(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x84ba
movq -0x188(%rbp), %rdi
cmpq %rbx, %rdi
je 0x12547
callq 0x3270
addq $0x30, %r15
cmpq -0x70(%rbp), %r15
jne 0x123eb
movq -0xf0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xeea6
testb %al, %al
movq -0x38(%rbp), %rax
movq -0x68(%rbp), %rcx
je 0x127ae
movb $0x4e, (%rax,%rcx)
movq -0xe8(%rbp), %rbx
movq %rbx, %rdi
movl $0x2e, %esi
xorl %edx, %edx
callq 0x3370
leaq -0x188(%rbp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x32c0
movq -0x40(%rbp), %rcx
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rcx
cmpq %rax, %rcx
je 0x1278e
xorl %edi, %edi
movq %rdi, -0x70(%rbp)
leaq (%rdi,%rdi,2), %rbx
movq %rbx, -0x30(%rbp)
shlq $0x5, %rbx
leaq (%rax,%rbx), %r14
addq $0x38, %r14
movq 0x10(%r14), %r15
cmpq %r14, %r15
je 0x12766
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x88b4
movq -0x108(%rbp), %rax
movq 0x8(%rax), %r13
leaq -0xd0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %r12
movq %r12, %rdi
callq 0x88b4
movq %r12, %rdi
leaq 0x1c8d(%rip), %rsi      # 0x142d0
callq 0x34f0
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
movq %r12, %rdi
callq 0x30c0
leaq -0xb0(%rbp), %rsi
movq %rsi, -0xc0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x12691
movq %rdx, -0xc0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xb0(%rbp)
jmp 0x12697
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0xb8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq -0x60(%rbp), %rcx
leaq -0x1c8(%rbp), %rdi
movq %r13, %rsi
leaq -0xc0(%rbp), %rdx
callq 0xc338
leaq -0x1a0(%rbp), %rdi
callq 0x7a6a
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0x126f7
callq 0x3270
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
leaq -0xa0(%rbp), %r13
je 0x12716
callq 0x3270
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x1272e
callq 0x3270
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x12746
callq 0x3270
movq %r15, %rdi
callq 0x3320
movq %rax, %r15
cmpq %r14, %rax
jne 0x125df
movq -0x40(%rbp), %rcx
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rcx
movq -0x70(%rbp), %rdi
incq %rdi
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x5, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %rdi, %rdx
ja 0x125ba
movq -0x188(%rbp), %rdi
leaq -0x178(%rbp), %rax
cmpq %rax, %rdi
je 0x127a6
callq 0x3270
movq -0x38(%rbp), %rax
movq -0x68(%rbp), %rcx
addq -0x100(%rbp), %rcx
cmpq -0xf8(%rbp), %rcx
jle 0x1237e
leaq -0x60(%rbp), %rdi
callq 0x89f0
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1284f
jmp 0x1284f
jmp 0x1284f
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x127fe
callq 0x3270
leaq -0x118(%rbp), %r14
jmp 0x1280a
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
jne 0x12834
jmp 0x1283e
jmp 0x1283b
jmp 0x1281e
jmp 0x1283b
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x1283e
callq 0x3270
jmp 0x1283e
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
callq 0xe72c
jmp 0x128df
movq %rax, %rbx
jmp 0x128df
movq %rbx, %rcx
movq %rax, %rbx
movq -0x188(%rbp), %rdi
cmpq %rcx, %rdi
jne 0x128da
jmp 0x128df
movq %rax, %rbx
jmp 0x128af
jmp 0x12872
movq %rax, %rbx
jmp 0x12897
movq %rax, %rbx
jmp 0x128c7
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x12897
callq 0x3270
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x128af
callq 0x3270
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x128c7
callq 0x3270
movq -0x188(%rbp), %rdi
leaq -0x178(%rbp), %rax
cmpq %rax, %rdi
je 0x128df
callq 0x3270
leaq -0x60(%rbp), %rdi
callq 0x89f0
movq %rbx, %rdi
callq 0x3480