// File: /workspace/github_cpp_makefile_star2_O3/dwburer[P]CSCI-3232-File-System/FileSystem.cpp
// Function: FileSystem::removeDirectory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FileSystem::removeDirectory(string dir) {
	
	if(currentDirectory->contains(dir)) {
		if(currentDirectory->children[dir]->isDirectory) {

			Directory* toDelete = (Directory*)(currentDirectory->children[dir]);

			if(toDelete->children.size() == 0) {
				cout << "Deleting directory " << dir << endl;
				delete currentDirectory->children[dir];
				currentDirectory->children.erase(dir);
			} else {
				cout << "Error: \"" << dir << "\" is not empty" << endl;
			}
		} else {
			cout << "Error: \"" << dir << "\" is a file, not a directory" << endl;
		}
	} else {
		cout << dir << ": No such directory found" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r15
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rsi), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x2ed4
movq %r15, %rdi
movq %r12, %rsi
callq 0x32d8
movl %eax, %r15d
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x3fb5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
testb %r15b, %r15b
je 0x402a
movq (%r14), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0x4a60
movq (%rax), %rax
cmpb $0x1, 0x31(%rax)
jne 0x404e
movq (%r14), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0x4a60
movq (%rax), %rax
cmpq $0x0, 0x68(%rax)
je 0x40c5
movq 0x3fda(%rip), %r14      # 0x7fd0
leaq 0x125f(%rip), %rsi      # 0x525c
movl $0x8, %edx
movq %r14, %rdi
callq 0x21e0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x21e0
movq %rax, %rbx
leaq 0x1242(%rip), %rsi      # 0x5265
movl $0xe, %edx
jmp 0x4087
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x3f98(%rip), %rdi      # 0x7fd0
callq 0x21e0
movq %rax, %rbx
leaq 0x124a(%rip), %rsi      # 0x5291
movl $0x19, %edx
jmp 0x4087
movq 0x3f7b(%rip), %r14      # 0x7fd0
leaq 0x1200(%rip), %rsi      # 0x525c
movl $0x8, %edx
movq %r14, %rdi
callq 0x21e0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x21e0
movq %rax, %rbx
leaq 0x11f2(%rip), %rsi      # 0x5274
movl $0x1c, %edx
movq %rax, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3f04(%rip), %r15      # 0x7fd0
leaq 0x1175(%rip), %rsi      # 0x5248
movl $0x13, %edx
movq %r15, %rdi
callq 0x21e0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %rdi
callq 0x21e0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq (%r14), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0x4a60
movq (%rax), %r15
testq %r15, %r15
je 0x4152
leaq 0x3bf9(%rip), %rax      # 0x7d30
movq %rax, (%r15)
movq 0x8(%r15), %rdi
leaq 0x18(%r15), %rax
cmpq %rax, %rdi
je 0x4152
movq (%rax), %rsi
incq %rsi
callq 0x21b0
movl $0x38, %esi
movq %r15, %rdi
callq 0x21b0
movq (%r14), %r14
addq $0x40, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4c02
movq %r14, %rdi
movq %rax, %rsi
callq 0x4cbe
jmp 0x40b6
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4199
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x22a0
nop