// File: /workspace/github_cpp_makefile_star2_O1/emr4378[P]FAT-File-System/Shell.cpp
// Function: Shell::runCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Shell::runCommand(string cmdline) {
	int ret = 0;
	string tokens[256];
	int i;
	int j;
	bool usingFake = false;
	getTokens(cmdline, " \n", tokens);
	bool leastOnePath = false;
	if (!tokens[0].empty()) {
		if (tokens[0] == "cd") {
			changeDirectory(tokens);
		} else {

			if (isCommandSupported(tokens[0])) {
				i = 1;
				while (!tokens[i].empty()) {
					if ((tokens[i][0] == '/' 
								|| (tokens[i].size() >= 1 
									&& tokens[i][0] != '-'))) {
						string newArg;
						getAbsoluteFromRelativePath(tokens[i], &newArg);
						tokens[i] = newArg;
						leastOnePath = true;
					}

					if (fakeFilePath->empty() == false && 
						(tokens[i].substr(0, 
							fakeFilePath->size()) == *fakeFilePath)) {
						usingFake = true;
					}
					i++;
				}
				if (!leastOnePath) {
					tokens[1] = *filePath;
					tokens[2].clear();

					if (fakeFilePath->empty() == false && 
						!tokens[1].empty() &&
						tokens[1].substr(0, 
							fakeFilePath->size()) == * fakeFilePath) {
						usingFake = true;
					}
				} 
			}

			if (usingFake) {
				ret = runFakeCommand(tokens);
				if (ret == -2) {
					cout << "ERROR: Not enough space in filesystem" << endl;
				} else if (ret < 0) {
					cout << tokens[0] << ": error with command" << endl;
				}
			} else {
				ret = runRealCommand(tokens);
			}
		}
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20c8, %rsp           # imm = 0x20C8
movq %rdi, %rbx
movl $0x10, %eax
leaq (%rsp,%rax), %rcx
addq $0xc0, %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
addq $0x20, %rax
cmpq $0x2010, %rax           # imm = 0x2010
jne 0x5dff
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x80(%rsp), %rdi
movq %rax, %rsi
callq 0x4e76
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x23ab(%rip), %rsi      # 0x8206
leaq 0x23a6(%rip), %rdx      # 0x8208
leaq 0x60(%rsp), %rdi
callq 0x50f4
leaq 0x80(%rsp), %rsi
leaq 0x60(%rsp), %rdx
leaq 0xc0(%rsp), %rcx
callq 0x6350
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x5e9d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x5eba
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21f0
xorl %ebp, %ebp
cmpq $0x0, 0xc8(%rsp)
je 0x623f
leaq 0x2337(%rip), %rsi      # 0x8209
leaq 0xc0(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0x6081
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0x4e76
leaq 0x40(%rsp), %rsi
callq 0x67aa
movl %eax, %ebp
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x5f30
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21f0
testb %bpl, %bpl
je 0x6096
movq 0xe8(%rsp), %rdx
testq %rdx, %rdx
je 0x609d
leaq 0xe0(%rsp), %r14
xorl %r15d, %r15d
xorl %ebp, %ebp
movq (%r14), %rsi
cmpb $0x2d, (%rsi)
je 0x5fdd
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x4e76
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
callq 0x5508
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x5fb4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %r14, %rdi
movq %rsp, %rsi
callq 0x20f0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5fda
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movb $0x1, %r15b
movq (%rbx), %rax
movq 0x8(%rax), %r12
testq %r12, %r12
je 0x602d
movq 0x8(%rax), %rcx
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2210
movq (%rbx), %rax
movq 0xa8(%rsp), %rdx
cmpq 0x8(%rax), %rdx
jne 0x602d
testq %rdx, %rdx
je 0x607c
movq (%rax), %rsi
movq 0xa0(%rsp), %rdi
callq 0x2200
testl %eax, %eax
sete %r13b
jmp 0x6030
xorl %r13d, %r13d
testq %r12, %r12
je 0x605a
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x605a
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21f0
movzbl %bpl, %ebp
testb %r13b, %r13b
movl $0x1, %eax
cmovnel %eax, %ebp
movq 0x28(%r14), %rdx
addq $0x20, %r14
testq %rdx, %rdx
jne 0x5f57
jmp 0x60a2
movb $0x1, %r13b
jmp 0x6030
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
callq 0x653e
jmp 0x623f
xorl %ebp, %ebp
jmp 0x6166
xorl %ebp, %ebp
xorl %r15d, %r15d
testb $0x1, %r15b
jne 0x6166
movq 0x8(%rbx), %rsi
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
callq 0x20f0
movq $0x0, 0x108(%rsp)
movq 0x100(%rsp), %rax
movb $0x0, (%rax)
movq (%rbx), %rax
cmpq $0x0, 0x8(%rax)
setne %cl
cmpq $0x0, 0xe8(%rsp)
setne %r15b
andb %cl, %r15b
cmpb $0x1, %r15b
jne 0x6134
movq 0x8(%rax), %rcx
movq %rsp, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2210
movq (%rbx), %rax
movq 0x8(%rsp), %rdx
cmpq 0x8(%rax), %rdx
jne 0x6134
testq %rdx, %rdx
je 0x6280
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0x2200
testl %eax, %eax
sete %r14b
jmp 0x6137
xorl %r14d, %r14d
testb %r15b, %r15b
je 0x6157
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6157
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movzbl %bpl, %eax
testb %r14b, %r14b
movl $0x1, %ebp
cmovel %eax, %ebp
testb $0x1, %bpl
je 0x61d0
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
callq 0x69c2
movl %eax, %ebp
cmpl $-0x2, %eax
jne 0x61e1
movq 0x4e46(%rip), %rbx      # 0xafd0
leaq 0x207b(%rip), %rsi      # 0x820c
movl $0x25, %edx
movq %rbx, %rdi
callq 0x2240
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x4e14(%rip), %rdi      # 0xafd0
callq 0x2050
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movq %rax, %rdi
callq 0x2120
jmp 0x623f
xorl %ebp, %ebp
leaq 0xc0(%rsp), %rsi
callq 0x712e
jmp 0x623f
testl %ebp, %ebp
jns 0x623f
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq 0x4dd4(%rip), %rdi      # 0xafd0
callq 0x2240
movq %rax, %rbx
leaq 0x2027(%rip), %rsi      # 0x8232
movl $0x14, %edx
movq %rax, %rdi
callq 0x2240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x2120
movq $-0x2000, %rbx          # imm = 0xE000
leaq 0x20b0(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0x6262
movq (%r14), %rsi
incq %rsi
callq 0x21f0
addq $-0x20, %r14
addq $0x20, %rbx
jne 0x624e
movl %ebp, %eax
addq $0x20c8, %rsp           # imm = 0x20C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %r14b
jmp 0x6137
jmp 0x62f8
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x631b
movq 0x50(%rsp), %rsi
jmp 0x6313
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x62c1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x62c1
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x631b
movq 0x90(%rsp), %rsi
jmp 0x6313
jmp 0x62f8
jmp 0x62f8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x6300
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x6300
movq %rax, %rbx
jmp 0x631b
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x631b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq $-0x2000, %r14          # imm = 0xE000
leaq 0x20b0(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x633e
movq (%r15), %rsi
incq %rsi
callq 0x21f0
addq $-0x20, %r15
addq $0x20, %r14
jne 0x632a
movq %rbx, %rdi
callq 0x23b0