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

  // look for the matching command
  if (command.name == "") {
    return false;
  }
  else if (command.name == "mkdir") {
    mkdir_rpc(command.file_name);
  }
  else if (command.name == "cd") {
    cd_rpc(command.file_name);
  }
  else if (command.name == "home") {
    home_rpc();
  }
  else if (command.name == "rmdir") {
    rmdir_rpc(command.file_name);
  }
  else if (command.name == "ls") {
    ls_rpc();
  }
  else if (command.name == "create") {
    create_rpc(command.file_name);
  }
  else if (command.name == "append") {
    append_rpc(command.file_name, command.append_data);
  }
  else if (command.name == "cat") {
    cat_rpc(command.file_name);
  }
  else if (command.name == "head") {
    errno = 0;
    unsigned long n = strtoul(command.append_data.c_str(), NULL, 0);
    if (0 == errno) {
      head_rpc(command.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_rpc(command.file_name);
  }
  else if (command.name == "stat") {
    stat_rpc(command.file_name);
  }
  else if (command.name == "quit") {
    return true;
  }

  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, %rbx
leaq 0x178(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x168(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x5c86
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x82a0
movq 0x168(%rsp), %rdi
cmpq %r15, %rdi
je 0x7a21
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x26c2(%rip), %rsi      # 0xa0ea
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7e58
leaq 0x280d(%rip), %rsi      # 0xa24e
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7b6d
leaq 0x27fa(%rip), %rsi      # 0xa254
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7bb0
leaq 0x27e4(%rip), %rsi      # 0xa257
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7bf3
leaq 0x27d0(%rip), %rsi      # 0xa25c
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7c00
leaq 0x27bd(%rip), %rsi      # 0xa262
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7c43
leaq 0x27a7(%rip), %rsi      # 0xa265
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7c50
leaq 0x2795(%rip), %rsi      # 0xa26c
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7c93
leaq 0x2783(%rip), %rsi      # 0xa273
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7d09
leaq 0x276e(%rip), %rsi      # 0xa277
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7d4c
leaq 0x2791(%rip), %rsi      # 0xa2b3
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7dca
leaq 0x277b(%rip), %rsi      # 0xa2b6
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
je 0x7e0a
leaq 0x2767(%rip), %rsi      # 0xa2bb
leaq 0x8(%rsp), %rdi
callq 0x30d0
testl %eax, %eax
jne 0x7e58
movb $0x1, %bl
jmp 0x7e5a
leaq 0x158(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x148(%rsp), %rdi
callq 0x5c86
leaq 0x148(%rsp), %rsi
movq %rbx, %rdi
callq 0x6220
movq 0x148(%rsp), %rdi
jmp 0x7e48
leaq 0x138(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x128(%rsp), %rdi
callq 0x5c86
leaq 0x128(%rsp), %rsi
movq %rbx, %rdi
callq 0x66cc
movq 0x128(%rsp), %rdi
jmp 0x7e48
movq %rbx, %rdi
callq 0x68c4
jmp 0x7e58
leaq 0x118(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x108(%rsp), %rdi
callq 0x5c86
leaq 0x108(%rsp), %rsi
movq %rbx, %rdi
callq 0x6a3c
movq 0x108(%rsp), %rdi
jmp 0x7e48
movq %rbx, %rdi
callq 0x6c34
jmp 0x7e58
leaq 0xf8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe8(%rsp), %rdi
callq 0x5c86
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6da6
movq 0xe8(%rsp), %rdi
jmp 0x7e48
leaq 0x198(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x188(%rsp), %rdi
callq 0x5c86
leaq 0x1b8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
leaq 0x1a8(%rsp), %rdi
callq 0x5c86
movq 0x1a8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x7cfc
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x188(%rsp), %rdi
jmp 0x7e48
leaq 0xd8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x5c86
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6fa0
movq 0xc8(%rsp), %rdi
jmp 0x7e48
callq 0x3050
movq %rax, %r15
movl $0x0, (%rax)
movq 0x48(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3100
movl (%r15), %ebp
testl %ebp, %ebp
je 0x7ebb
movq 0x5276(%rip), %rdi      # 0xcff0
leaq 0x24fb(%rip), %rsi      # 0xa27c
movl $0x16, %edx
callq 0x3310
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x5254(%rip), %rdi      # 0xcff0
callq 0x3310
movq 0x5248(%rip), %rdi      # 0xcff0
leaq 0x24e4(%rip), %rsi      # 0xa293
movl $0x1f, %edx
callq 0x3310
movq 0x5230(%rip), %rdi      # 0xcff0
callq 0x3170
jmp 0x7f05
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x5c86
leaq 0xa8(%rsp), %rsi
movq %rbx, %rdi
callq 0x7564
movq 0xa8(%rsp), %rdi
jmp 0x7e48
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x5c86
leaq 0x88(%rsp), %rsi
movq %rbx, %rdi
callq 0x775c
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x7e58
movq (%r14), %rsi
incq %rsi
callq 0x32c0
xorl %ebx, %ebx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7e75
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7e90
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7eab
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32c0
movl %ebx, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x5c86
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x7198
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x7f05
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32c0
testl %ebp, %ebp
jmp 0x7e58
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x8019
movq 0x78(%rsp), %rsi
jmp 0x800c
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0x98(%rsp), %rsi
jmp 0x800c
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0xb8(%rsp), %rsi
jmp 0x800c
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0xd8(%rsp), %rsi
jmp 0x800c
movq %rax, %rbx
movq 0x188(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0x198(%rsp), %rsi
jmp 0x800c
jmp 0x8016
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0xf8(%rsp), %rsi
jmp 0x800c
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0x118(%rsp), %rsi
jmp 0x800c
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0x138(%rsp), %rsi
jmp 0x800c
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
je 0x8019
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x32c0
jmp 0x8019
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x8b70
jmp 0x8045
movq %rax, %rbx
movq 0x168(%rsp), %rdi
cmpq %r15, %rdi
je 0x8045
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x3440
nop