// File: /workspace/github_cpp_makefile_star2_O1/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 $0xa08, %rsp            # imm = 0xA08
cmpl $0x3, %edi
jne 0x696c
movq %rsi, %rbx
leaq 0x18(%rsp), %rdi
callq 0x703e
leaq 0xc0(%rsp), %rdi
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0xa79a
movq 0x8(%rbx), %rsi
leaq 0x330(%rsp), %rdi
leaq 0x5f4(%rsp), %rdx
callq 0x71de
movq 0x10(%rbx), %rsi
leaq 0x108(%rsp), %rdi
leaq 0x800(%rsp), %rdx
callq 0x71de
leaq 0x50(%rsp), %rdi
leaq 0x330(%rsp), %rsi
leaq 0x108(%rsp), %rdx
movl $0x20, %ecx
callq 0x721c
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x68f9
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0x340(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x691a
movq 0x340(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0x330(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x72ba
movq 0x330(%rsp), %rcx
movq 0x338(%rsp), %rdx
movq 0x340(%rsp), %rax
movq %rcx, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
testq %rdx, %rdx
je 0x6992
movq 0x1764e(%rip), %rcx     # 0x1dfb0
cmpb $0x0, (%rcx)
je 0x698e
incl 0x8(%rdx)
jmp 0x6992
movl $0x1, %ebx
movq 0x17670(%rip), %rdi     # 0x1dfe8
leaq 0xd6fd(%rip), %rsi      # 0x1407c
movl $0x21, %edx
callq 0x6380
jmp 0x6c52
lock
incl 0x8(%rdx)
movq %rdx, 0x10(%rsp)
leaq 0x38(%rsp), %rdx
movq %rax, 0x10(%rdx)
leaq 0x330(%rsp), %rdi
leaq 0x18(%rsp), %rbx
movq %rbx, %rsi
callq 0x737c
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x69c4
callq 0x9b8a
leaq 0xaf7(%rip), %rax       # 0x74c2
leaq 0x108(%rsp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
movq %rbx, 0x10(%rsi)
leaq 0x28(%rsp), %rdi
callq 0x755a
movq 0x175dd(%rip), %r12     # 0x1dfd0
leaq 0x800(%rsp), %r13
leaq 0x5f4(%rsp), %rbp
leaq 0x108(%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 0x6b0d
xorl %r15d, %r15d
movq %r15, 0x7f8(%rsp)
movq %r13, %rdi
callq 0x6150
movl $0x200, %ecx            # imm = 0x200
cmpq %rcx, %rax
cmovaeq %rcx, %rax
movq %rax, 0x7f8(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x6270
movb $0x0, 0x10c(%rsp)
movl $0x0, 0x108(%rsp)
movq 0x7f8(%rsp), %rdx
movq %r14, %rdi
leaq 0xdaf7(%rip), %rsi      # 0x14596
xorl %eax, %eax
callq 0x6090
movl 0x108(%rsp), %eax
movq 0x330(%rsp), %rbx
movl %eax, 0x120(%rsp)
movl $0x20c, %edx            # imm = 0x20C
leaq 0x124(%rsp), %rdi
movq %rbp, %rsi
callq 0x6270
leaq 0xb8e4(%rip), %rax      # 0x123bc
movq %rax, 0x108(%rsp)
movq %r15, 0x110(%rsp)
leaq 0x330(%rsp), %rax
movq %rax, 0x118(%rsp)
leaq 0xf(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12486
jmp 0x6a0b
movq 0x330(%rsp), %rdx
leaq 0xb168(%rip), %rax      # 0x11c84
leaq 0x108(%rsp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
leaq 0x330(%rsp), %rax
movq %rax, 0x10(%rsi)
leaq 0x5f4(%rsp), %rdi
callq 0x1317c
leaq 0x28(%rsp), %rdi
callq 0x6070
movq %rax, %rbx
callq 0x62b0
cmpq %rbx, %rax
je 0x6c66
leaq 0x28(%rsp), %rdi
callq 0x6420
leaq 0x28(%rsp), %rdi
callq 0x75f4
leaq 0x598(%rsp), %rdi
callq 0xa0c4
leaq 0x338(%rsp), %rdi
callq 0xa114
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6ba0
callq 0x9b8a
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6bc1
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6be2
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x6330
leaq 0xc0(%rsp), %rdi
callq 0xcaec
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rbx
testq %rbx, %rbx
je 0x6c0c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x20(%rbx), %rbx
jmp 0x6bf8
movq 0x18(%rsp), %rbx
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x6c30
movq (%rdi), %rax
movq 0x20(%rdi), %r14
callq *0x8(%rax)
movq %r14, 0x38(%rbx)
movq %r14, %rdi
testq %r14, %r14
jne 0x6c1a
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0x6c50
leaq 0x8(%rbx), %rdi
callq 0x6390
movl $0x40, %esi
movq %rbx, %rdi
callq 0x6330
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xa08, %rsp            # imm = 0xA08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd92d(%rip), %rsi      # 0x1459a
leaq 0x108(%rsp), %rdi
callq 0x65e0
movabsq $0x100000023, %rax      # imm = 0x100000023
leaq 0x138(%rsp), %rcx
movq %rax, -0x20(%rcx)
leaq 0x16189(%rip), %rax     # 0x1ce20
movq %rax, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x16827(%rip), %rax     # 0x1d4d8
movq %rax, -0x30(%rcx)
leaq 0x108(%rsp), %rdi
callq 0x9bf9
movq %rdx, %r15
movq %rax, %r14
leaq 0x108(%rsp), %rdi
callq 0x7820
jmp 0x6d91
jmp 0x6d81
movq %rdx, %r15
movq %rax, %r14
jmp 0x6d9b
movq %rdx, %r15
movq %rax, %r14
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x6db5
callq 0x9b8a
jmp 0x6db5
movq %rdx, %r15
movq %rax, %r14
jmp 0x6dc7
movq %rdx, %r15
movq %rax, %r14
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6d42
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x6330
jmp 0x6d42
movq %rdx, %r15
movq %rax, %r14
leaq 0x340(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6dd1
movq 0x340(%rsp), %rsi
incq %rsi
callq 0x6330
jmp 0x6dd1
movq %rdx, %r15
movq %rax, %r14
jmp 0x6dd1
movq %rdx, %r15
movq %rax, %r14
jmp 0x6dde
jmp 0x6d77
movq %rdx, %r15
movq %rax, %r14
jmp 0x6de8
jmp 0x6d8b
movq %rax, %rdi
callq 0x6f45
jmp 0x6d8b
movq %rdx, %r15
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x75f4
leaq 0x598(%rsp), %rdi
callq 0xa0c4
leaq 0x338(%rsp), %rdi
callq 0xa114
cmpq $0x0, 0x10(%rsp)
je 0x6dc7
movq 0x10(%rsp), %rdi
callq 0x9b8a
leaq 0x50(%rsp), %rdi
callq 0x7612
leaq 0xc0(%rsp), %rdi
callq 0xcaec
leaq 0x18(%rsp), %rdi
callq 0x764a
cmpl $0x1, %r15d
jne 0x6e4f
movq %r14, %rdi
callq 0x6140
movq %rax, %rbx
movq 0x171e8(%rip), %rdi     # 0x1dfe8
leaq 0xd297(%rip), %rsi      # 0x1409e
movl $0xb, %edx
callq 0x6380
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x171c7(%rip), %rdi     # 0x1dfe8
movq %rax, %rsi
callq 0x6300
leaq 0xd26c(%rip), %rsi      # 0x1409c
movl $0x1, %edx
movq %rax, %rdi
callq 0x6380
callq 0x6530
jmp 0x6c50
movq %rax, %r14
callq 0x6530
movq %r14, %rdi
callq 0x6560
jmp 0x6d81