// File: /workspace/github_cpp_makefile_star2_O3/emr4378[P]FAT-File-System/Shell.cpp
// Function: Shell::changeDirectory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
int Shell::changeDirectory(string tokens[]) {
	int i;
	int j;
	i = 1;
	string absPath;
	while (!tokens[i].empty() && absPath.empty()) {
		if (tokens[i][0] != '-') {
			getAbsoluteFromRelativePath(tokens[i], &absPath);
			*filePath = absPath;
			i++;
		}
	}

	if (checkIfDirExists(*filePath) || 
		(*filePath == *fakeFilePath && fakeFilePath->empty() == false)){
			*oldFilePath = *filePath;
			chdir((*filePath).c_str());
	} else {
		cout << "cd: " << *filePath << ": No such directory" << endl;
		*filePath = *oldFilePath;
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x28(%rsi), %rdx
testq %rdx, %rdx
je 0x65cb
movq %rsi, %r14
leaq 0x20(%rsi), %rax
movl $0x1, %r13d
leaq 0x58(%rsp), %rbp
leaq 0x48(%rsp), %r15
leaq 0x28(%rsp), %r12
movq (%rax), %rsi
movb $0x1, %cl
cmpb $0x2d, (%rsi)
je 0x65b3
movq %rbp, 0x48(%rsp)
addq %rsi, %rdx
movq %r15, %rdi
callq 0x4e42
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x54da
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x659b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x8(%rbx), %rdi
movq %r12, %rsi
callq 0x20f0
incl %r13d
cmpq $0x0, 0x30(%rsp)
sete %cl
movslq %r13d, %rax
shlq $0x5, %rax
movq 0x8(%r14,%rax), %rdx
testq %rdx, %rdx
je 0x65cb
addq %r14, %rax
testb %cl, %cl
jne 0x655c
movq 0x8(%rbx), %rax
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x4e42
movq 0x8(%rsp), %rdi
callq 0x22f0
testq %rax, %rax
je 0x6632
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x6612
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdi
callq 0x20f0
movq 0x8(%rbx), %rax
movq (%rax), %rdi
callq 0x22d0
xorl %ebx, %ebx
jmp 0x670e
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
movq 0x8(%rax), %r14
cmpq 0x8(%rcx), %r14
jne 0x665a
testq %r14, %r14
je 0x6673
movq (%rcx), %rsi
movq (%rax), %rdi
movq %r14, %rdx
callq 0x2200
testl %eax, %eax
je 0x6673
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x668f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x668f
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x668a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
testq %r14, %r14
jne 0x6612
movq 0x493a(%rip), %rdi      # 0xafd0
leaq 0x1c0c(%rip), %rsi      # 0x82a9
movl $0x4, %edx
callq 0x2240
movq 0x8(%rbx), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x4917(%rip), %rdi      # 0xafd0
callq 0x2240
movq %rax, %r14
leaq 0x1be6(%rip), %rsi      # 0x82ae
movl $0x13, %edx
movq %rax, %rdi
callq 0x2240
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x2120
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
callq 0x20f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x672a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6759
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x675c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x675c
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x6778
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0