// File: /workspace/github_cpp_makefile_star2_O2/hyp1231[P]FMSS/main.cpp
// Function: exec_opt(FileSystem&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
bool exec_opt(FileSystem& S, vector<string>& opt) {
	if(opt.empty()) { return true; }
	bool flag = true; string str;
	switch(string_to_enum[opt[0]]) {
		case _help:			// help
			S.Help(); break;
		case _exit:			// exit
			flag = false; break;
        case _create:       // touch
            S.CreateFile(opt[1]); break;
        case _delete:       // rm
        	if((int)opt.size() > 2) {
        		S.DeleteFile(opt[2], opt[1]);
        	} else {
        		S.DeleteFile(opt[1]);
        	}
            break;
        case _list:         // ls
            if ((int)opt.size() > 2) {
                cout << "[Error] Too many parameters in command \"ls\"" << endl;
                S.Help();
            } else if((int)opt.size() == 2) {	// -a or -l
            	S.ListFile(opt[1]);
            } else {					// none
            	S.ListFile();
            } 
            break;
        case _move:			// mv
        	S.MoveFile(opt[1], opt[2]); break;
        case _print:		// cat
        	S.PrintFile(opt[1]); break;
        case _write:		// echo
        	if(opt.size() != 4 || opt[2] != ">") {
        		cout << "[Error] Illegal param" << endl;
        		break;
        	}
        	S.WriteFile(opt[1], opt[3]); break;
        case _mkdir:        // mkdir
            S.CreateDir(opt[1]); break;
        case _cd:           // cd
            if ((int)opt.size() < 2) {
                cout << "[Error] Directory path should be provided" << endl;
                cout << "cd [dirpath]" << endl;
                break;
            }
            S.OpenDir(opt[1]); break;
        case _copy:			// cp
        	S.CopyFile(opt[1], opt[2]); break;
		case undefined_opt:	// unknowned
			cout << "[Error] Unknown option" << endl; break;
		default: break;
	}
	return flag;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r15
movq (%rsi), %rsi
cmpq 0x8(%r15), %rsi
je 0x6026
movq %rdi, %r14
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x51f9(%rip), %rdi      # 0xb1f0
callq 0x6648
movl (%rax), %eax
movb $0x1, %bl
cmpq $0xb, %rax
ja 0x624f
leaq 0x171b(%rip), %rcx      # 0x772c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x17b7(%rip), %r12      # 0x77d8
jmp 0x6192
movb $0x1, %bl
jmp 0x625c
movq (%r15), %rdx
leaq 0x20(%rdx), %rsi
addq $0x40, %rdx
movq %r14, %rdi
callq 0x4bda
jmp 0x624f
movq (%r15), %r12
movq 0x8(%r15), %rax
subq %r12, %rax
shrq $0x5, %rax
cmpl $0x3, %eax
jl 0x61ae
leaq 0x20(%r12), %rsi
leaq 0x68(%rsp), %rdi
callq 0x22b0
addq $0x40, %r12
leaq 0x68(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x38e0
leaq 0x68(%rsp), %rdi
jmp 0x624a
movq (%r15), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x4252
jmp 0x624f
xorl %ebx, %ebx
jmp 0x624f
movq (%r15), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x372c
jmp 0x624f
movq (%r15), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x5208
jmp 0x624f
movq (%r15), %rsi
movq 0x8(%r15), %rax
subq %rsi, %rax
movq %rax, %rcx
shrq $0x5, %rcx
cmpl $0x3, %ecx
jl 0x61df
movq 0x4ee3(%rip), %rdi      # 0xafd0
leaq 0x166b(%rip), %rsi      # 0x775f
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x2d9e
jmp 0x624f
movq (%r15), %rdx
leaq 0x20(%rdx), %rsi
addq $0x40, %rdx
movq %r14, %rdi
callq 0x50d0
jmp 0x624f
movq (%r15), %rsi
movq 0x8(%r15), %rax
subq %rsi, %rax
shrq $0x5, %rax
cmpl $0x1, %eax
jg 0x6214
movq 0x4e8c(%rip), %rdi      # 0xafd0
leaq 0x1656(%rip), %rsi      # 0x77a1
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
leaq 0x166c(%rip), %r12      # 0x77cb
jmp 0x6192
movq (%r15), %rdi
movq 0x8(%r15), %rax
subq %rdi, %rax
leaq 0x1619(%rip), %r12      # 0x778b
cmpq $0x80, %rax
jne 0x6192
addq $0x40, %rdi
leaq 0x143a(%rip), %rsi      # 0x75bf
callq 0x54bf
testb %al, %al
je 0x626d
movq 0x4e37(%rip), %rdi      # 0xafd0
movq %r12, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
jmp 0x624f
leaq 0x147c(%rip), %rsi      # 0x7631
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x27fc
addq $0x20, %r12
leaq 0x48(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x38e0
leaq 0x48(%rsp), %rdi
jmp 0x624a
movabsq $0x1fffffffe0, %rcx     # imm = 0x1FFFFFFFE0
andq %rcx, %rax
cmpq $0x40, %rax
jne 0x6222
addq $0x20, %rsi
leaq 0x28(%rsp), %rdi
callq 0x22b0
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x3dc4
leaq 0x28(%rsp), %rdi
jmp 0x624a
addq $0x20, %rsi
movq %r14, %rdi
callq 0x4404
jmp 0x624f
leaq 0x1408(%rip), %rsi      # 0x7631
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x27fc
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3dc4
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x88(%rsp), %rdi
callq 0x20e0
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%r15), %rdx
leaq 0x20(%rdx), %rsi
addq $0x60, %rdx
movq %r14, %rdi
callq 0x5312
jmp 0x624f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
jmp 0x62aa
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x62aa
jmp 0x62b3
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x62aa
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x20e0
jmp 0x62b6
jmp 0x62b3
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2340