// File: dmonaldo[P]simple-network-file-system/Shell.cpp
// Function: Shell::head_rpc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void Shell::head_rpc(string fname, int n) {
  // to implement
  string command = "head " + fname + to_string(n) + "\r\n";
  char message[2048];
  char received[2048];
  strcpy(message, command.c_str());

  // send to server
  send(cs_sock, message, sizeof(message), 0);
  recv(cs_sock, received, sizeof(received), 0);

  // print
  print_response("head", received);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1120, %rsp           # imm = 0x1120
movl %edx, %eax
movq %rsi, %rdx
movq %rdi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1108(%rbp)
leaq 0x3db9(%rip), %rsi      # 0xc516
leaq -0x78(%rbp), %rdi
callq 0xa180
movl -0x14(%rbp), %esi
leaq -0x98(%rbp), %rdi
callq 0xa360
jmp 0x8777
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0xa290
jmp 0x878d
leaq 0x3954(%rip), %rdx      # 0xc0e8
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xa130
jmp 0x87a3
leaq -0x58(%rbp), %rdi
callq 0x3628
leaq -0x98(%rbp), %rdi
callq 0x3628
leaq -0x78(%rbp), %rdi
callq 0x3628
leaq -0x38(%rbp), %rdi
callq 0x3190
movq %rax, %rsi
leaq -0x8b0(%rbp), %rdi
movq %rdi, -0x1110(%rbp)
callq 0x3320
movq -0x1110(%rbp), %rsi
movq -0x1108(%rbp), %rax
movl (%rax), %edi
movl $0x800, %edx            # imm = 0x800
xorl %ecx, %ecx
callq 0x31d0
jmp 0x87fe
movq -0x1108(%rbp), %rax
movl (%rax), %edi
leaq -0x10b0(%rbp), %rsi
movl $0x800, %edx            # imm = 0x800
xorl %ecx, %ecx
callq 0x3140
jmp 0x881c
leaq -0x10d1(%rbp), %rdi
movq %rdi, -0x1118(%rbp)
callq 0x3570
movq -0x1118(%rbp), %rdx
leaq 0x3a3a(%rip), %rsi      # 0xc277
leaq -0x10d0(%rbp), %rdi
callq 0x69b0
jmp 0x884b
leaq -0x10f9(%rbp), %rdi
movq %rdi, -0x1120(%rbp)
callq 0x3570
movq -0x1120(%rbp), %rdx
leaq -0x10f8(%rbp), %rdi
leaq -0x10b0(%rbp), %rsi
callq 0x69b0
jmp 0x887a
movq -0x1108(%rbp), %rdi
leaq -0x10d0(%rbp), %rsi
leaq -0x10f8(%rbp), %rdx
callq 0x7850
jmp 0x8896
leaq -0x10f8(%rbp), %rdi
callq 0x3628
leaq -0x10f9(%rbp), %rdi
callq 0x33b0
leaq -0x10d0(%rbp), %rdi
callq 0x3628
leaq -0x10d1(%rbp), %rdi
callq 0x33b0
leaq -0x38(%rbp), %rdi
callq 0x3628
addq $0x1120, %rsp           # imm = 0x1120
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x8927
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x891b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3628
leaq -0x98(%rbp), %rdi
callq 0x3628
leaq -0x78(%rbp), %rdi
callq 0x3628
jmp 0x89bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x89b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x89a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x898f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x10f8(%rbp), %rdi
callq 0x3628
leaq -0x10f9(%rbp), %rdi
callq 0x33b0
leaq -0x10d0(%rbp), %rdi
callq 0x3628
leaq -0x10d1(%rbp), %rdi
callq 0x33b0
leaq -0x38(%rbp), %rdi
callq 0x3628
movq -0xa0(%rbp), %rdi
callq 0x3560
nopl (%rax,%rax)