// File: zimpha[P]MiniSQL/CatalogManager.cc
// Function: CatalogManager::dropTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void CatalogManager::dropTable(const std::string &tableName) {
    assert(hasTable(tableName));
    std::string name = tableName.substr(0, tableName.find('.'));
    Table nt = loadTable(tableName);
    std::vector<AttrType> &attr = nt.attributes;
    for (size_t i = 0; i < attr.size(); ++ i) {
        bool flag = false;
        for (auto &x : attr[i].indices) {
            flag = true;
            dropIndex(x);
        }
        if (flag) {
            BFM bm;
            std::string indexFileName = name + "." + attr[i].name + ".index";
            bm.deleteFile(indexFileName);
        }
    }

    remove((tableName).c_str());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x130(%rbp)
movq -0x10(%rbp), %rsi
callq 0x1b550
testb $0x1, %al
jne 0x1bacd
jmp 0x1bacf
jmp 0x1baee
leaq 0xb8d5(%rip), %rdi      # 0x273ab
leaq 0xb8e2(%rip), %rsi      # 0x273bf
movl $0x32, %edx
leaq 0xb973(%rip), %rcx      # 0x2745c
callq 0x31f0
movq -0x10(%rbp), %rdi
movq %rdi, -0x140(%rbp)
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x138(%rbp)
movl $0x2e, %esi
callq 0x33c0
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
movq %rax, %rcx
leaq -0x30(%rbp), %rdi
callq 0x32f0
movq -0x130(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x1b750
jmp 0x1bb3e
leaq -0x78(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x90(%rbp), %rdi
callq 0x7750
movq %rax, %rcx
movq -0x148(%rbp), %rax
cmpq %rcx, %rax
jae 0x1bd68
movb $0x0, -0x99(%rbp)
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x7810
addq $0x30, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x1c060
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x1c090
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xc8c0
testb $0x1, %al
jne 0x1bbe9
jmp 0x1bc50
leaq -0xb0(%rbp), %rdi
callq 0x1c0c0
movq -0x130(%rbp), %rdi
movq %rax, -0xc0(%rbp)
movb $0x1, -0x99(%rbp)
movq -0xc0(%rbp), %rsi
callq 0x1bdb0
jmp 0x1bc18
jmp 0x1bc1a
leaq -0xb0(%rbp), %rdi
callq 0x1c0e0
jmp 0x1bbd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1bd9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1bd94
testb $0x1, -0x99(%rbp)
je 0x1bd4f
leaq 0xb626(%rip), %rdx      # 0x2728a
leaq -0x128(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x76d0
jmp 0x1bc76
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x7810
movq %rax, %rdx
leaq -0x108(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x78a0
jmp 0x1bca1
leaq 0xb479(%rip), %rdx      # 0x27121
leaq -0xe8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x79e0
jmp 0x1bcbd
leaq -0x108(%rbp), %rdi
callq 0x35b8
leaq -0x128(%rbp), %rdi
callq 0x35b8
leaq -0xc1(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xf740
jmp 0x1bcea
leaq -0xe8(%rbp), %rdi
callq 0x35b8
jmp 0x1bd4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1bd24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x35b8
leaq -0x128(%rbp), %rdi
callq 0x35b8
jmp 0x1bd94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x35b8
jmp 0x1bd94
jmp 0x1bd51
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x1bb58
movq -0x10(%rbp), %rdi
callq 0x3120
movq %rax, %rdi
callq 0x3520
leaq -0x78(%rbp), %rdi
callq 0x7920
leaq -0x30(%rbp), %rdi
callq 0x35b8
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x7920
leaq -0x30(%rbp), %rdi
callq 0x35b8
movq -0x80(%rbp), %rdi
callq 0x34f0
nop