// File: plasma-umass[P]simplesocket/client.cpp
// Function: main
int main (int argc, char * argv[])
{
  if (argc < 3) {
    cerr << "Usage: " << argv[0] << " <port> <id>" << endl;
    exit (-1);
  }
  int port;
  int id;
  stringstream (argv[1]) >> port;
  stringstream (argv[2]) >> id;
  clientsocket * s = new clientsocket("127.0.0.1", port);
  s->connect();
  stringstream output;
  output << "CLIENT MESSAGE FROM " << id;
  cout << "client about to send: " << output.str().c_str() << endl;
  *s << output.str();
  string result;
  *s >> result;
  cout << "Received: {" << result << "}" << endl;

  s->close();
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5f0, %rsp            # imm = 0x5F0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
jge 0x3649
movq 0x49ea(%rip), %rdi      # 0x7ff0
leaq 0x29f7(%rip), %rsi      # 0x6004
callq 0x3260
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x3260
movq %rax, %rdi
leaq 0x29e1(%rip), %rsi      # 0x600c
callq 0x3260
movq %rax, %rdi
movq 0x497e(%rip), %rsi      # 0x7fb8
callq 0x3290
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3300
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x588(%rbp)
leaq -0x1c1(%rbp), %rdi
movq %rdi, -0x580(%rbp)
callq 0x3400
movq -0x588(%rbp), %rsi
movq -0x580(%rbp), %rdx
leaq -0x1c0(%rbp), %rdi
callq 0x3b50
jmp 0x3687
movl $0x10, %edi
movl $0x8, %esi
callq 0x3c00
movl %eax, -0x58c(%rbp)
jmp 0x369e
movl -0x58c(%rbp), %edx
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x33a0
jmp 0x36b9
leaq -0x1a0(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x3b20
jmp 0x36cb
leaq -0x1a0(%rbp), %rdi
callq 0x31b0
leaq -0x1c0(%rbp), %rdi
callq 0x3150
leaq -0x1c1(%rbp), %rdi
callq 0x32b0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x5a0(%rbp)
leaq -0x381(%rbp), %rdi
movq %rdi, -0x598(%rbp)
callq 0x3400
movq -0x5a0(%rbp), %rsi
movq -0x598(%rbp), %rdx
leaq -0x380(%rbp), %rdi
callq 0x3b50
jmp 0x372d
movl $0x10, %edi
movl $0x8, %esi
callq 0x3c00
movl %eax, -0x5a4(%rbp)
jmp 0x3744
movl -0x5a4(%rbp), %edx
leaq -0x360(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x33a0
jmp 0x375f
leaq -0x360(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3b20
jmp 0x3771
leaq -0x360(%rbp), %rdi
callq 0x31b0
leaq -0x380(%rbp), %rdi
callq 0x3150
leaq -0x381(%rbp), %rdi
callq 0x32b0
movl $0x1e0, %edi            # imm = 0x1E0
callq 0x3270
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5b0(%rbp)
movl -0x14(%rbp), %edx
leaq 0x2863(%rip), %rsi      # 0x6019
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
callq 0x3c20
jmp 0x37c5
movq -0x5b0(%rbp), %rax
movq %rax, -0x390(%rbp)
movq -0x390(%rbp), %rdi
callq 0x4d70
leaq -0x518(%rbp), %rdi
callq 0x3190
leaq -0x508(%rbp), %rdi
leaq 0x282a(%rip), %rsi      # 0x6023
callq 0x3260
movq %rax, -0x5b8(%rbp)
jmp 0x3807
movq -0x5b8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x33e0
jmp 0x3818
movq 0x47a9(%rip), %rdi      # 0x7fc8
leaq 0x2812(%rip), %rsi      # 0x6038
callq 0x3260
movq %rax, -0x5c0(%rbp)
jmp 0x3834
leaq -0x538(%rbp), %rdi
leaq -0x518(%rbp), %rsi
callq 0x3250
jmp 0x3849
leaq -0x538(%rbp), %rdi
callq 0x30e0
movq -0x5c0(%rbp), %rdi
movq %rax, %rsi
callq 0x3260
movq %rax, -0x5c8(%rbp)
jmp 0x386d
movq -0x5c8(%rbp), %rdi
movq 0x473d(%rip), %rsi      # 0x7fb8
callq 0x3290
jmp 0x3882
leaq -0x538(%rbp), %rdi
callq 0x3150
movq -0x390(%rbp), %rax
movq %rax, -0x5d0(%rbp)
leaq -0x558(%rbp), %rdi
leaq -0x518(%rbp), %rsi
callq 0x3250
jmp 0x38b1
movq -0x5d0(%rbp), %rdi
leaq -0x558(%rbp), %rsi
callq 0x3ca0
jmp 0x38c6
leaq -0x558(%rbp), %rdi
callq 0x3150
leaq -0x578(%rbp), %rdi
movq %rdi, -0x5d8(%rbp)
callq 0x3350
movq -0x5d8(%rbp), %rsi
movq -0x390(%rbp), %rdi
callq 0x3db0
jmp 0x38fa
movq 0x46c7(%rip), %rdi      # 0x7fc8
leaq 0x2747(%rip), %rsi      # 0x604f
callq 0x3260
movq %rax, -0x5e0(%rbp)
jmp 0x3916
movq -0x5e0(%rbp), %rdi
leaq -0x578(%rbp), %rsi
callq 0x3230
movq %rax, -0x5e8(%rbp)
jmp 0x3932
movq -0x5e8(%rbp), %rdi
leaq 0x271b(%rip), %rsi      # 0x605b
callq 0x3260
movq %rax, -0x5f0(%rbp)
jmp 0x394e
movq -0x5f0(%rbp), %rdi
movq 0x465c(%rip), %rsi      # 0x7fb8
callq 0x3290
jmp 0x3963
movq -0x390(%rbp), %rdi
callq 0x47d0
jmp 0x3971
movl $0x0, -0x4(%rbp)
leaq -0x578(%rbp), %rdi
callq 0x3150
leaq -0x518(%rbp), %rdi
callq 0x31b0
movl -0x4(%rbp), %eax
addq $0x5f0, %rsp            # imm = 0x5F0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
jmp 0x39ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
jmp 0x39e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x31b0
leaq -0x1c0(%rbp), %rdi
callq 0x3150
leaq -0x1c1(%rbp), %rdi
callq 0x32b0
jmp 0x3b05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
jmp 0x3a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
jmp 0x3a45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x360(%rbp), %rdi
callq 0x31b0
leaq -0x380(%rbp), %rdi
callq 0x3150
leaq -0x381(%rbp), %rdi
callq 0x32b0
jmp 0x3b05
movq -0x5b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x3280
jmp 0x3b05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
jmp 0x3af9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x3150
jmp 0x3af9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x558(%rbp), %rdi
callq 0x3150
jmp 0x3af9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x578(%rbp), %rdi
callq 0x3150
leaq -0x518(%rbp), %rdi
callq 0x31b0
movq -0x1d0(%rbp), %rdi
callq 0x33f0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)