// File: /workspace/github_cpp_makefile_star2_O1/dmonaldo[P]simple-network-file-system/FileSys.cpp
// Function: FileSys::execute_command(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool FileSys::execute_command(string command_str)
{
  // parse the command line
  struct FileSys::Command command = parse_command(command_str);

  // copy the contents of the string to char array
  const char* command_name = command.name.c_str();
  const char* file_name = command.file_name.c_str();
  const char* append_data = command.append_data.c_str();

  // look for the matching command
  if (command.name == "") {
    return false;
  }
  else if (command.name == "mkdir") {
    mkdir(file_name);
  }
  else if (command.name == "cd") {
    cd(file_name);
  }
  else if (command.name == "home") {
    home();
  }
  else if (command.name == "rmdir") {
    rmdir(file_name);
  }
  else if (command.name == "ls") {
    ls();
  }
  else if (command.name == "create") {
    create(file_name);
  }
  else if (command.name == "append") {
    append(file_name, append_data);
  }
  else if (command.name == "cat") {
    cat(file_name);
  }
  else if (command.name == "head") {
    errno = 0;
    unsigned long n = strtoul(command.append_data.c_str(), NULL, 0);
    if (0 == errno) {
      head(file_name, n);
    } else {
      cerr << "Invalid command line: " << command.append_data;
      cerr << " is not a valid number of bytes" << endl;
      return false;
    }
  }
  else if (command.name == "rm") {
    rm(file_name);
  }
  else if (command.name == "stat") {
    stat(file_name);
  }
  else if (command.name == "quit") {
    return true;
  }

  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %rdi, %rbx
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x5c86
movq %rsp, %rdi
movq %r14, %rdx
callq 0x4cf6
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x49f7
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32c0
movq %rsp, %rdi
movq 0x20(%rdi), %r14
leaq 0x56e5(%rip), %rsi      # 0xa0ea
callq 0x30d0
testl %eax, %eax
je 0x4c62
leaq 0x5835(%rip), %rsi      # 0xa24e
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4b2d
leaq 0x5824(%rip), %rsi      # 0xa254
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4b3d
leaq 0x5810(%rip), %rsi      # 0xa257
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4b4d
leaq 0x57fe(%rip), %rsi      # 0xa25c
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4b87
leaq 0x57ed(%rip), %rsi      # 0xa262
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4b97
leaq 0x57d9(%rip), %rsi      # 0xa265
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4ba4
leaq 0x57c9(%rip), %rsi      # 0xa26c
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4c62
leaq 0x57b9(%rip), %rsi      # 0xa273
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4bb4
leaq 0x57a6(%rip), %rsi      # 0xa277
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4bc4
leaq 0x57cb(%rip), %rsi      # 0xa2b3
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4c3b
leaq 0x57b7(%rip), %rsi      # 0xa2b6
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x4c48
leaq 0x57a5(%rip), %rsi      # 0xa2bb
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x4c62
movb $0x1, %bl
jmp 0x4c64
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3af8
jmp 0x4c62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d08
jmp 0x4c62
movw $0x1, 0x4(%rbx)
movups 0x55c9(%rip), %xmm0     # 0xa123
leaq 0x80(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $0xa0d0a0d30203a, %rax  # imm = 0xA0D0A0D30203A
movq %rax, 0xf(%rsi)
movl 0x8(%rbx), %edi
movl $0x400, %edx            # imm = 0x400
xorl %ecx, %ecx
callq 0x3180
jmp 0x4c62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ed2
jmp 0x4c62
movq %rbx, %rdi
callq 0x40a4
jmp 0x4c62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42c4
jmp 0x4c62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e2
jmp 0x4c62
callq 0x3050
movq %rax, %r15
movl $0x0, (%rax)
movq 0x40(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3100
movl (%r15), %ebp
testl %ebp, %ebp
je 0x4c55
movq 0x8402(%rip), %rdi      # 0xcff0
leaq 0x5687(%rip), %rsi      # 0xa27c
movl $0x16, %edx
callq 0x3310
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x83e0(%rip), %rdi      # 0xcff0
callq 0x3310
movq 0x83d4(%rip), %rdi      # 0xcff0
leaq 0x5670(%rip), %rsi      # 0xa293
movl $0x1f, %edx
callq 0x3310
movq 0x83bc(%rip), %rdi      # 0xcff0
callq 0x3170
jmp 0x4c60
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44ae
jmp 0x4c62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4632
jmp 0x4c62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57e4
testl %ebp, %ebp
xorl %ebx, %ebx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4c7f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4c9a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4cb5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
movl %ebx, %eax
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4cc7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5b0e
jmp 0x4cee
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x4cee
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x3440