// File: /workspace/github_cpp_makefile_star2_O1/dmonaldo[P]simple-network-file-system/Shell.cpp
// Function: Shell::print_response(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Shell::print_response(string command, string response)
{
  stringstream ss(response);
  string item;
  vector<string> splitResponse;

  // split response by line breaks into an array of strings
  while (getline(ss, item, '\n')) {
     splitResponse.push_back(item);
  }

  // check if response was successful
  if (stoi(response.substr(0,3)) == 200) {
    if (command == "ls" ||
        command == "head" ||
        command == "stat" ||
        command == "cat") {
      cout << splitResponse[3] << endl;
    }
  } else {
    cout << response << endl;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdx, %r14
movq %rsi, %rbx
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
movl $0x18, %edx
callq 0x3400
leaq 0x10(%rsp), %rbp
movq %rbp, -0x10(%rbp)
xorl %eax, %eax
movq %rax, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x40(%rsp), %r12
movq %rax, 0x10(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
movq %rsp, %r13
movq %r15, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x3470
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x6497
movq %r12, %rdi
movq %r13, %rsi
callq 0x8c7c
jmp 0x646c
leaq 0x20(%rsp), %rdi
movl $0x3, %ecx
movq %r14, %rsi
xorl %edx, %edx
callq 0x32d0
movq 0x20(%rsp), %r12
callq 0x3050
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x58(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x3380
cmpq %r12, (%r13)
je 0x6635
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x6641
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x6641
testl %ecx, %ecx
jne 0x64fe
movl %ebp, (%r15)
movl %eax, %r15d
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x651c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
cmpl $0xc8, %r15d
leaq 0x10(%rsp), %rbp
jne 0x65a8
leaq 0x3d31(%rip), %rsi      # 0xa262
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
je 0x6576
leaq 0x3d33(%rip), %rsi      # 0xa277
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
je 0x6576
leaq 0x3d5f(%rip), %rsi      # 0xa2b6
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
je 0x6576
leaq 0x3d09(%rip), %rsi      # 0xa273
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x65e5
movq 0x40(%rsp), %rax
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
movq 0x6a3e(%rip), %rdi      # 0xcfc8
callq 0x3310
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3280
jmp 0x65d2
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x6a12(%rip), %rdi      # 0xcfc8
callq 0x3310
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
leaq 0x40(%rsp), %rdi
callq 0x8a8c
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x6605
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x6994(%rip), %rsi      # 0xcfa0
leaq 0x60(%rsp), %rdi
callq 0x3210
leaq 0xe0(%rsp), %rdi
callq 0x3120
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f05(%rip), %rdi      # 0xa541
callq 0x31b0
leaq 0x3ef9(%rip), %rdi      # 0xa541
callq 0x33b0
movq %rax, %rbx
jmp 0x6679
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x665e
movl %ebp, (%r15)
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6679
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x10(%rsp), %rbp
jmp 0x6685
jmp 0x6682
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x8a8c
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x66a5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x68f4(%rip), %rsi      # 0xcfa0
leaq 0x60(%rsp), %rdi
callq 0x3210
leaq 0xe0(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3440
nop