// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r15
movq (%rsi), %rsi
cmpq 0x8(%r15), %rsi
je 0x7fc1
movq %rdi, %r14
leaq 0x98(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x526c(%rip), %rdi      # 0xd1f8
callq 0x881e
movl (%rax), %eax
movb $0x1, %bl
cmpq $0xb, %rax
ja 0x82b8
leaq 0x181a(%rip), %rcx      # 0x97c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x16, %r12d
leaq 0x18b0(%rip), %r13      # 0x986c
jmp 0x8184
movb $0x1, %bl
jmp 0x82d5
movq (%r15), %rdx
leaq 0x20(%rdx), %rsi
addq $0x40, %rdx
movq %r14, %rdi
callq 0x644a
jmp 0x82b8
movq (%r15), %r12
movq 0x8(%r15), %rax
subq %r12, %rax
shrq $0x5, %rax
cmpl $0x3, %eax
jl 0x81c9
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x7268
addq $0x40, %r12
leaq 0x68(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x487e
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x82b8
movq 0x78(%rsp), %rsi
jmp 0x82b0
movq (%r15), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x5714
jmp 0x82b8
xorl %ebx, %ebx
jmp 0x82b8
movq (%r15), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x45fc
jmp 0x82b8
movq (%r15), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x6cac
jmp 0x82b8
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
movq %rcx, %rdx
shrq $0x5, %rdx
cmpl $0x3, %edx
jl 0x8216
movq 0x4f29(%rip), %rdi      # 0xcfd0
leaq 0x1745(%rip), %rsi      # 0x97f3
movl $0x2b, %edx
callq 0x2240
movq 0x4f11(%rip), %rdi      # 0xcfd0
callq 0x20f0
movq %r14, %rdi
callq 0x30c8
jmp 0x82b8
movq (%r15), %rdx
leaq 0x20(%rdx), %rsi
addq $0x40, %rdx
movq %r14, %rdi
callq 0x6ab8
jmp 0x82b8
movq (%r15), %rsi
movq 0x8(%r15), %rax
subq %rsi, %rax
shrq $0x5, %rax
cmpl $0x1, %eax
jg 0x8265
movq 0x4ec9(%rip), %rdi      # 0xcfd0
leaq 0x1727(%rip), %rsi      # 0x9835
movl $0x29, %edx
callq 0x2240
movq 0x4eb1(%rip), %rdi      # 0xcfd0
callq 0x20f0
movq 0x4ea5(%rip), %rdi      # 0xcfd0
leaq 0x172d(%rip), %rsi      # 0x985f
movl $0xc, %edx
callq 0x2240
movq 0x4e8d(%rip), %rdi      # 0xcfd0
callq 0x20f0
jmp 0x82b8
movq (%r15), %rdi
movq 0x8(%r15), %rax
subq %rdi, %rax
movl $0x15, %r12d
leaq 0x16bb(%rip), %r13      # 0x981f
cmpq $0x80, %rax
jne 0x8184
addq $0x40, %rdi
leaq 0x14d9(%rip), %rsi      # 0x9650
callq 0x2090
testl %eax, %eax
je 0x82e9
movq 0x4e45(%rip), %r14      # 0xcfd0
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x2240
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0x4e19(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
jmp 0x82b8
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x14e9(%rip), %rsi      # 0x96c2
leaq 0x14e6(%rip), %rdx      # 0x96c6
leaq 0x48(%rsp), %rdi
callq 0x2920
addq $0x20, %r12
leaq 0x48(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x487e
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x82b8
movq 0x58(%rsp), %rsi
jmp 0x82b0
movabsq $0x1fffffffe0, %rdx     # imm = 0x1FFFFFFFE0
andq %rdx, %rcx
cmpq $0x40, %rcx
jne 0x8273
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x7268
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x501c
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x82b8
movq 0x38(%rsp), %rsi
jmp 0x82b0
addq $0x20, %rsi
movq %r14, %rdi
callq 0x5992
jmp 0x82b8
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x143f(%rip), %rsi      # 0x96c2
leaq 0x143c(%rip), %rdx      # 0x96c6
leaq 0x8(%rsp), %rdi
callq 0x2920
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x501c
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x82b8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0x82d5
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2200
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rdx
leaq 0x20(%rdx), %rsi
addq $0x60, %rdx
movq %r14, %rdi
callq 0x6e64
jmp 0x82b8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x835d
movq 0x18(%rsp), %rsi
jmp 0x834e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x835d
movq 0x38(%rsp), %rsi
jmp 0x834e
jmp 0x835a
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x835d
movq 0x58(%rsp), %rsi
jmp 0x834e
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x835d
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x835d
jmp 0x835a
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0x837a
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2350