// File: /workspace/github_cpp_makefile_star2_O1/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 0x15be(%rip), %rsi      # 0x50e2
movq %r14, %rdi
callq 0x2080
movq (%rbx), %r15
testl %eax, %eax
je 0x3c25
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 0x2ed0
movq %r15, %rdi
movq %r12, %rsi
callq 0x32cc
movl %eax, %r15d
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x3b78
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
testb %r15b, %r15b
je 0x3c3c
movq (%rbx), %rdi
addq $0x40, %rdi
movq %r14, %rsi
callq 0x4a5c
movq (%rax), %rax
cmpb $0x1, 0x31(%rax)
jne 0x3cb6
movq %rax, (%rbx)
movq 0x4429(%rip), %r14      # 0x7fd0
leaq 0x1607(%rip), %rsi      # 0x51b5
movl $0x19, %edx
movq %r14, %rdi
callq 0x21e0
movq (%rbx), %rsi
leaq -0x68(%rbp), %rbx
movq %rbx, %rdi
callq 0x3070
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 0x3d07
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3d07
cmpb $0x1, 0x70(%r15)
jne 0x3c57
movq %r15, %rdi
callq 0x32f0
movq %rax, (%rbx)
jmp 0x3d07
movq 0x438d(%rip), %rbx      # 0x7fd0
leaq 0x159a(%rip), %rsi      # 0x51e4
movl $0x29, %edx
movq %rbx, %rdi
jmp 0x3cdb
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x436b(%rip), %rdi      # 0x7fd0
callq 0x21e0
movq %rax, %rbx
leaq 0x152d(%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 0x430c(%rip), %rdi      # 0x7fd0
callq 0x21e0
movq %rax, %rbx
leaq 0x14fc(%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 0x3d44
movq -0x58(%rbp), %rsi
jmp 0x3d3c
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x3d44
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x22a0