// File: /workspace/github_cpp_makefile_star2_O3/dwburer[P]CSCI-3232-File-System/FileSystem.cpp
// Function: FileSystem::changeDirectory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FileSystem::changeDirectory(string dir) {
	if(!dir.compare("..")) {
		if(currentDirectory->hasParent) {
			currentDirectory = currentDirectory->getParent();
		} else {
			cout << dir << ": Invalid directory" << endl;
		}
	} else if(currentDirectory->contains(dir)){
		Entity* newDir = currentDirectory->children[dir];

		if(newDir->isDirectory) {
			currentDirectory = (Directory*) newDir;
			cout << "Current directory is now " << currentDirectory->getName() << endl;
		} else {
			cout << dir << ": Is not a directory" << endl;
		}
	} else {
		cout << "The requested destination does not exist " << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x15ba(%rip), %rsi      # 0x50e2
movq %r14, %rdi
callq 0x2080
movq (%rbx), %r15
testl %eax, %eax
je 0x3c29
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %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 0x3b7c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
testb %r15b, %r15b
je 0x3c40
movq (%rbx), %rdi
addq $0x40, %rdi
movq %r14, %rsi
callq 0x4a60
movq (%rax), %rax
cmpb $0x1, 0x31(%rax)
jne 0x3cba
movq %rax, (%rbx)
movq 0x4425(%rip), %r14      # 0x7fd0
leaq 0x1603(%rip), %rsi      # 0x51b5
movl $0x19, %edx
movq %r14, %rdi
callq 0x21e0
movq (%rbx), %rsi
leaq -0x68(%rbp), %rbx
movq %rbx, %rdi
callq 0x307c
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x21e0
movq %rax, %rbx
movq (%rax), %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
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d0b
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3d0b
cmpb $0x1, 0x70(%r15)
jne 0x3c5b
movq %r15, %rdi
callq 0x32fc
movq %rax, (%rbx)
jmp 0x3d0b
movq 0x4389(%rip), %rbx      # 0x7fd0
leaq 0x1596(%rip), %rsi      # 0x51e4
movl $0x29, %edx
movq %rbx, %rdi
jmp 0x3cdf
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x4367(%rip), %rdi      # 0x7fd0
callq 0x21e0
movq %rax, %rbx
leaq 0x1529(%rip), %rsi      # 0x51a1
movl $0x13, %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
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2110
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x4308(%rip), %rdi      # 0x7fd0
callq 0x21e0
movq %rax, %rbx
leaq 0x14f8(%rip), %rsi      # 0x51cf
movl $0x14, %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 $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d48
movq -0x58(%rbp), %rsi
jmp 0x3d40
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x3d48
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x22a0