// File: wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::drop_table(char const*)
RC SM_Manager::drop_table(const char* tablename)//////////////need more
{
	for(int i = 0;i < databases[current_db_index].table.size();i++)
	{
		if(strcmp(tablename,databases[current_db_index].table[i].tablename) == 0)
		{// delete this table,
			string de_file(databases[i].dbname);
			de_file = de_file + "/"+tablename;
			record_manager->destroyFile(de_file.c_str());
			databases[current_db_index].table.erase(databases[current_db_index].table.begin()+i);
			de_file = de_file+".www";
			record_manager->destroyFile(de_file.c_str());
			return 0;
				//delete corresponding table info
		}

	}
	printf("Table %s does not exists!\n",tablename);
	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0xe0(%rbp), %rdi
movslq -0x1c(%rbp), %rax
movq %rax, -0xe8(%rbp)
movslq 0x18(%rdi), %rsi
callq 0x6c50
movq %rax, %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x6c70
movq %rax, %rcx
movq -0xe8(%rbp), %rax
cmpq %rcx, %rax
jae 0x4f95
movq -0xe0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xf0(%rbp)
movslq 0x18(%rdi), %rsi
callq 0x6c50
movq %rax, %rdi
addq $0x100, %rdi            # imm = 0x100
movslq -0x1c(%rbp), %rsi
callq 0x6ca0
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
callq 0x2300
cmpl $0x0, %eax
jne 0x4f85
movq -0xe0(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x6c50
movq %rax, -0x100(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x23d0
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x61e0
jmp 0x4d88
leaq -0x41(%rbp), %rdi
callq 0x2260
leaq 0xa539(%rip), %rdx      # 0xf2d1
leaq -0x98(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x6e50
jmp 0x4daa
movq -0x18(%rbp), %rdx
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x6e00
jmp 0x4dc0
leaq -0x40(%rbp), %rdi
movq %rdi, -0x110(%rbp)
leaq -0x78(%rbp), %rsi
movq %rsi, -0x118(%rbp)
callq 0x22b0
movq -0x118(%rbp), %rdi
callq 0x2130
leaq -0x98(%rbp), %rdi
callq 0x2130
movq -0xe0(%rbp), %rax
movq -0x110(%rbp), %rdi
movq 0x20(%rax), %rax
movq %rax, -0x108(%rbp)
callq 0x20b0
movq -0x108(%rbp), %rdi
movq %rax, %rsi
callq 0x3ed0
jmp 0x4e22
movq -0xe0(%rbp), %rdi
movslq 0x18(%rdi), %rsi
callq 0x6c50
movq -0xe0(%rbp), %rdi
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x128(%rbp)
movslq 0x18(%rdi), %rsi
callq 0x6c50
movq %rax, %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x70b0
movq %rax, -0xb0(%rbp)
movslq -0x1c(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x70e0
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x7120
movq -0x128(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x7040
movq %rax, -0x120(%rbp)
jmp 0x4eab
movq -0x120(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq 0xa413(%rip), %rdx      # 0xf2d3
leaq -0xd8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x6e50
jmp 0x4ed2
leaq -0x40(%rbp), %rdi
movq %rdi, -0x138(%rbp)
leaq -0xd8(%rbp), %rsi
movq %rsi, -0x140(%rbp)
callq 0x22b0
movq -0x140(%rbp), %rdi
callq 0x2130
movq -0xe0(%rbp), %rax
movq -0x138(%rbp), %rdi
movq 0x20(%rax), %rax
movq %rax, -0x130(%rbp)
callq 0x20b0
movq -0x130(%rbp), %rdi
movq %rax, %rsi
callq 0x3ed0
jmp 0x4f2b
movl $0x0, -0x4(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2130
jmp 0x4fae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x2260
jmp 0x4fba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4f7a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x2130
leaq -0x40(%rbp), %rdi
callq 0x2130
jmp 0x4fba
jmp 0x4f87
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4cc5
movq -0x18(%rbp), %rsi
leaq 0xa338(%rip), %rdi      # 0xf2d8
movb $0x0, %al
callq 0x2040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x23c0
nopw %cs:(%rax,%rax)