// File: /workspace/github_cpp_makefile_star2_O3/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 0x6509
movq %r12, %rdi
movq %r13, %rsi
callq 0x8cc0
jmp 0x64de
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 0x66a7
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x66b3
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x66b3
testl %ecx, %ecx
jne 0x6570
movl %ebp, (%r15)
movl %eax, %r15d
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x658e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
cmpl $0xc8, %r15d
leaq 0x10(%rsp), %rbp
jne 0x661a
leaq 0x3d0b(%rip), %rsi      # 0xa2ae
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
je 0x65e8
leaq 0x3d0d(%rip), %rsi      # 0xa2c3
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
je 0x65e8
leaq 0x3d39(%rip), %rsi      # 0xa302
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
je 0x65e8
leaq 0x3ce3(%rip), %rsi      # 0xa2bf
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x6657
movq 0x40(%rsp), %rax
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
movq 0x69cc(%rip), %rdi      # 0xcfc8
callq 0x3310
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3280
jmp 0x6644
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x69a0(%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 0x8ace
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x6677
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x6922(%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 0x3ee3(%rip), %rdi      # 0xa591
callq 0x31b0
leaq 0x3ed7(%rip), %rdi      # 0xa591
callq 0x33b0
movq %rax, %rbx
jmp 0x66eb
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x66d0
movl %ebp, (%r15)
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66eb
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x10(%rsp), %rbp
jmp 0x66f7
jmp 0x66f4
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x8ace
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x6717
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x6882(%rip), %rsi      # 0xcfa0
leaq 0x60(%rsp), %rdi
callq 0x3210
leaq 0xe0(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3440
nop