// File: /workspace/github_cpp_makefile_star2_O1/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 0x2ed0
movq %r15, %rdi
movq %r12, %rsi
callq 0x32cc
movl %eax, %r15d
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x3fb1
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
testb %r15b, %r15b
je 0x4026
movq (%r14), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0x4a5c
movq (%rax), %rax
cmpb $0x1, 0x31(%rax)
jne 0x404a
movq (%r14), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0x4a5c
movq (%rax), %rax
cmpq $0x0, 0x68(%rax)
je 0x40c1
movq 0x3fde(%rip), %r14      # 0x7fd0
leaq 0x1263(%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 0x1246(%rip), %rsi      # 0x5265
movl $0xe, %edx
jmp 0x4083
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x3f9c(%rip), %rdi      # 0x7fd0
callq 0x21e0
movq %rax, %rbx
leaq 0x124e(%rip), %rsi      # 0x5291
movl $0x19, %edx
jmp 0x4083
movq 0x3f7f(%rip), %r14      # 0x7fd0
leaq 0x1204(%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 0x11f6(%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 0x3f08(%rip), %r15      # 0x7fd0
leaq 0x1179(%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 0x4a5c
movq (%rax), %r15
testq %r15, %r15
je 0x415b
leaq 0x3bfd(%rip), %rax      # 0x7d30
movq %rax, (%r15)
movq 0x8(%r15), %rdi
leaq 0x18(%r15), %rax
cmpq %rax, %rdi
je 0x414e
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 0x4bfe
movq %r14, %rdi
movq %rax, %rsi
callq 0x4cb0
jmp 0x40b2
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4195
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x22a0
nop