// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, %rbx
leaq 0x170(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x160(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x5ce8
movq %rsp, %rdi
movq %r14, %rdx
callq 0x82e6
movq 0x160(%rsp), %rdi
cmpq %r15, %rdi
je 0x7a9c
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x2693(%rip), %rsi      # 0xa136
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7ef2
leaq 0x27e0(%rip), %rsi      # 0xa29a
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7bce
leaq 0x27cf(%rip), %rsi      # 0xa2a0
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7c11
leaq 0x27bb(%rip), %rsi      # 0xa2a3
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7c54
leaq 0x27a9(%rip), %rsi      # 0xa2a8
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7c61
leaq 0x2798(%rip), %rsi      # 0xa2ae
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7ca4
leaq 0x2784(%rip), %rsi      # 0xa2b1
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7cb1
leaq 0x2774(%rip), %rsi      # 0xa2b8
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7cf4
leaq 0x2764(%rip), %rsi      # 0xa2bf
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7d6a
leaq 0x2751(%rip), %rsi      # 0xa2c3
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7dad
leaq 0x2776(%rip), %rsi      # 0xa2ff
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7e2a
leaq 0x2762(%rip), %rsi      # 0xa302
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
je 0x7e6a
leaq 0x2750(%rip), %rsi      # 0xa307
movq %rsp, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x7ef2
movb $0x1, %bl
jmp 0x7ef4
leaq 0x150(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x140(%rsp), %rdi
callq 0x5ce8
leaq 0x140(%rsp), %rsi
movq %rbx, %rdi
callq 0x6290
movq 0x140(%rsp), %rdi
jmp 0x7ee2
leaq 0x130(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rdi
callq 0x5ce8
leaq 0x120(%rsp), %rsi
movq %rbx, %rdi
callq 0x673e
movq 0x120(%rsp), %rdi
jmp 0x7ee2
movq %rbx, %rdi
callq 0x6938
jmp 0x7ef2
leaq 0x110(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0x5ce8
leaq 0x100(%rsp), %rsi
movq %rbx, %rdi
callq 0x6ab0
movq 0x100(%rsp), %rdi
jmp 0x7ee2
movq %rbx, %rdi
callq 0x6caa
jmp 0x7ef2
leaq 0xf0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe0(%rsp), %rdi
callq 0x5ce8
leaq 0xe0(%rsp), %rsi
movq %rbx, %rdi
callq 0x6e1c
movq 0xe0(%rsp), %rdi
jmp 0x7ee2
leaq 0x190(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x180(%rsp), %rdi
callq 0x5ce8
leaq 0x1b0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x1a0(%rsp), %rdi
callq 0x5ce8
movq 0x1a0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x7d5d
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x180(%rsp), %rdi
jmp 0x7ee2
leaq 0xd0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc0(%rsp), %rdi
callq 0x5ce8
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
callq 0x7018
movq 0xc0(%rsp), %rdi
jmp 0x7ee2
callq 0x3050
movq %rax, %r15
movl $0x0, (%rax)
movq 0x40(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3100
cmpl $0x0, (%r15)
je 0x7e9e
movq 0x5216(%rip), %rdi      # 0xcff0
leaq 0x24e7(%rip), %rsi      # 0xa2c8
movl $0x16, %edx
callq 0x3310
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x51f4(%rip), %rdi      # 0xcff0
callq 0x3310
movq 0x51e8(%rip), %rdi      # 0xcff0
leaq 0x24d0(%rip), %rsi      # 0xa2df
movl $0x1f, %edx
callq 0x3310
movq 0x51d0(%rip), %rdi      # 0xcff0
callq 0x3170
jmp 0x7ef2
leaq 0x90(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x5ce8
leaq 0x80(%rsp), %rsi
movq %rbx, %rdi
callq 0x75de
movq 0x80(%rsp), %rdi
jmp 0x7ee2
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0x5ce8
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x77d8
movq 0x60(%rsp), %rdi
jmp 0x7ee2
movq %rax, %r14
leaq 0xb0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x5ce8
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x7212
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x7ef2
movq (%r15), %rsi
incq %rsi
callq 0x32c0
xorl %ebx, %ebx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f0f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f2a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f45
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
movl %ebx, %eax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0xb0(%rsp), %rsi
jmp 0x8054
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0x70(%rsp), %rsi
jmp 0x8054
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0x90(%rsp), %rsi
jmp 0x8054
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0xd0(%rsp), %rsi
jmp 0x8054
movq %rax, %rbx
movq 0x180(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0x190(%rsp), %rsi
jmp 0x8054
jmp 0x805e
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0xf0(%rsp), %rsi
jmp 0x8054
movq %rax, %rbx
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0x110(%rsp), %rsi
jmp 0x8054
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0x130(%rsp), %rsi
jmp 0x8054
movq %rax, %rbx
movq 0x140(%rsp), %rdi
cmpq %r15, %rdi
je 0x8061
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x32c0
jmp 0x8061
movq %rax, %rbx
movq %rsp, %rdi
callq 0x8bb4
jmp 0x808b
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %r15, %rdi
je 0x808b
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x3440
nop