// File: /workspace/github_cpp_makefile_star2_O3/jflemer[P]boost-chat-server/chat_client.cpp
// Function: main
int main(int argc, char* argv[])
{
  try
  {
    if (argc != 3)
    {
      std::cerr << "Usage: chat_client <host> <port>\n";
      return 1;
    }

    boost::asio::io_service io_service;

    tcp::resolver resolver(io_service);
    tcp::resolver::query query(argv[1], argv[2]);
    tcp::resolver::iterator iterator = resolver.resolve(query);

    chat_client<> c(io_service, iterator);

    boost::thread t(boost::bind(&boost::asio::io_service::run, &io_service));

    char line[chat_message::max_body_length + 1];
    while (std::cin.getline(line, chat_message::max_body_length + 1))
    {
      using namespace std; // For strlen and memcpy.
      chat_message msg;
      msg.body_length(strlen(line));
      memcpy(msg.body(), line, msg.body_length());
      msg.encode_header();
      c.write(msg);
    }

    c.close();
    t.join();
  }
  catch (std::exception& e)
  {
    std::cerr << "Exception: " << e.what() << "\n";
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9f8, %rsp            # imm = 0x9F8
cmpl $0x3, %edi
jne 0x694c
movq %rsi, %rbx
leaq 0x10(%rsp), %rdi
callq 0x7020
leaq 0xb8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0xa63e
movq 0x8(%rbx), %rsi
leaq 0x328(%rsp), %rdi
leaq 0x5e4(%rsp), %rdx
callq 0x71c6
movq 0x10(%rbx), %rsi
leaq 0x100(%rsp), %rdi
leaq 0x7f0(%rsp), %rdx
callq 0x71c6
leaq 0x48(%rsp), %rdi
leaq 0x328(%rsp), %rsi
leaq 0x100(%rsp), %rdx
movl $0x20, %ecx
callq 0x7204
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68d9
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0x338(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68fa
movq 0x338(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0x328(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x72a2
movq 0x328(%rsp), %rcx
movq 0x330(%rsp), %rdx
movq 0x338(%rsp), %rax
movq %rcx, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
testq %rdx, %rdx
je 0x6972
movq 0x1666e(%rip), %rcx     # 0x1cfb0
cmpb $0x0, (%rcx)
je 0x696e
incl 0x8(%rdx)
jmp 0x6972
movl $0x1, %ebx
movq 0x16690(%rip), %rdi     # 0x1cfe8
leaq 0xc71d(%rip), %rsi      # 0x1307c
movl $0x21, %edx
callq 0x6380
jmp 0x6c2f
lock
incl 0x8(%rdx)
movq %rdx, 0x8(%rsp)
leaq 0x30(%rsp), %rdx
movq %rax, 0x10(%rdx)
leaq 0x328(%rsp), %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x7364
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x69a4
callq 0x9ae4
leaq 0xaff(%rip), %rax       # 0x74aa
leaq 0x100(%rsp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
movq %rbx, 0x10(%rsi)
leaq 0x20(%rsp), %rdi
callq 0x7542
movq 0x165fd(%rip), %r12     # 0x1cfd0
leaq 0x7f0(%rsp), %r13
movl $0x200, %r15d           # imm = 0x200
leaq 0x5e4(%rsp), %rbp
leaq 0x100(%rsp), %r14
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x62f0
movsbl %al, %ecx
movl $0x201, %edx            # imm = 0x201
movq %r12, %rdi
movq %r13, %rsi
callq 0x6600
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x6ae7
movq %r13, %rdi
callq 0x6150
cmpq %r15, %rax
cmovaeq %r15, %rax
movq %rax, 0x7e8(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x6270
movb $0x0, 0x104(%rsp)
movl $0x0, 0x100(%rsp)
movq 0x7e8(%rsp), %rdx
movq %r14, %rdi
leaq 0xcb21(%rip), %rsi      # 0x13596
xorl %eax, %eax
callq 0x6090
movl 0x100(%rsp), %eax
movq 0x328(%rsp), %rbx
movl %eax, 0x118(%rsp)
movl $0x20c, %edx            # imm = 0x20C
leaq 0x11c(%rsp), %rdi
movq %rbp, %rsi
callq 0x6270
leaq 0xb4d0(%rip), %rax      # 0x11f7e
movq %rax, 0x100(%rsp)
movq $0x0, 0x108(%rsp)
leaq 0x328(%rsp), %rax
movq %rax, 0x110(%rsp)
leaq 0x7(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12048
jmp 0x69f1
movq 0x328(%rsp), %rdx
leaq 0xacac(%rip), %rax      # 0x117a2
leaq 0x100(%rsp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
leaq 0x328(%rsp), %rax
movq %rax, 0x10(%rsi)
leaq 0x5e4(%rsp), %rdi
callq 0x12c78
leaq 0x20(%rsp), %rdi
callq 0x6070
movq %rax, %rbx
callq 0x62b0
cmpq %rbx, %rax
je 0x6c47
leaq 0x20(%rsp), %rdi
callq 0x6420
leaq 0x20(%rsp), %rdi
callq 0x75dc
leaq 0x590(%rsp), %rdi
callq 0x9fc8
leaq 0x330(%rsp), %rdi
callq 0xa020
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x6b7a
callq 0x9ae4
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6b9b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6bbc
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0xb8(%rsp), %rdi
callq 0xc8d6
movq 0x10(%rsp), %rbx
movq 0x38(%rbx), %r14
testq %r14, %r14
je 0x6c17
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq 0x20(%r14), %r14
testq %r14, %r14
jne 0x6bd7
movq 0x10(%rsp), %rbx
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x6c17
movq (%rdi), %rax
movq 0x20(%rdi), %r14
callq *0x8(%rax)
movq %r14, 0x38(%rbx)
movq %r14, %rdi
testq %r14, %r14
jne 0x6bf7
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x6c43
leaq 0x8(%rbx), %rdi
callq 0x6390
movl $0x40, %esi
movq %rbx, %rdi
callq 0x6330
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x9f8, %rsp            # imm = 0x9F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x6c20
leaq 0xc94c(%rip), %rsi      # 0x1359a
leaq 0x100(%rsp), %rdi
callq 0x65e0
movabsq $0x100000023, %rax      # imm = 0x100000023
leaq 0x130(%rsp), %rcx
movq %rax, -0x20(%rcx)
leaq 0x15258(%rip), %rax     # 0x1bed0
movq %rax, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x158c6(%rip), %rax     # 0x1c558
movq %rax, -0x30(%rcx)
leaq 0x100(%rsp), %rdi
callq 0x9b53
movq %rdx, %r15
movq %rax, %r14
leaq 0x100(%rsp), %rdi
callq 0x780a
jmp 0x6d72
jmp 0x6d62
movq %rdx, %r15
movq %rax, %r14
jmp 0x6d7c
movq %rdx, %r15
movq %rax, %r14
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x6d96
callq 0x9ae4
jmp 0x6d96
movq %rdx, %r15
movq %rax, %r14
jmp 0x6da8
movq %rdx, %r15
movq %rax, %r14
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6d23
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x6330
jmp 0x6d23
movq %rdx, %r15
movq %rax, %r14
leaq 0x338(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6db2
movq 0x338(%rsp), %rsi
incq %rsi
callq 0x6330
jmp 0x6db2
movq %rdx, %r15
movq %rax, %r14
jmp 0x6db2
movq %rdx, %r15
movq %rax, %r14
jmp 0x6dbf
jmp 0x6d58
movq %rdx, %r15
movq %rax, %r14
jmp 0x6dc9
jmp 0x6d6c
movq %rax, %rdi
callq 0x6f27
jmp 0x6d6c
movq %rdx, %r15
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x75dc
leaq 0x590(%rsp), %rdi
callq 0x9fc8
leaq 0x330(%rsp), %rdi
callq 0xa020
cmpq $0x0, 0x8(%rsp)
je 0x6da8
movq 0x8(%rsp), %rdi
callq 0x9ae4
leaq 0x48(%rsp), %rdi
callq 0x75fa
leaq 0xb8(%rsp), %rdi
callq 0xc8d6
leaq 0x10(%rsp), %rdi
callq 0x7632
cmpl $0x1, %r15d
jne 0x6e30
movq %r14, %rdi
callq 0x6140
movq %rax, %rbx
movq 0x16207(%rip), %rdi     # 0x1cfe8
leaq 0xc2b6(%rip), %rsi      # 0x1309e
movl $0xb, %edx
callq 0x6380
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x161e6(%rip), %rdi     # 0x1cfe8
movq %rax, %rsi
callq 0x6300
leaq 0xc28b(%rip), %rsi      # 0x1309c
movl $0x1, %edx
movq %rax, %rdi
callq 0x6380
callq 0x6530
jmp 0x6c2d
movq %rax, %r14
callq 0x6530
movq %r14, %rdi
callq 0x6560
jmp 0x6d62
nop