// File: /workspace/github_cpp_makefile_star2_O2/jBlinden[P]private-codis/ProtocolClient.cpp
// Function: StartClient(char const*, int, 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 StartClient(const char *address, int port, string pArgsFile, string clientDataDir)
{
  CSocket *socket = new CSocket();

  if (Connect(socket, address, port))
  {
    ClientLog("successfully connected to server");
  }
  else
  {
    stringstream ss;
    ss << "unable to connect to port " << port << " on address " << address;
    ClientLog(ss.str());
    return;
  }

  auto t_start = chrono::high_resolution_clock::now();

  RunClientProtocol(socket, pArgsFile, clientDataDir);

  auto t_end = chrono::high_resolution_clock::now();
  chrono::duration<float> duration = t_end - t_start;

  ClientLog("protocol execution completed");

  cout << "protocol execution time: " << duration.count() << " seconds" << endl;
  cout << "total bytes sent: " << socket->GetBytesSent() << endl;
  cout << "total bytes received: " << socket->GetBytesReceived() << endl;
  cout << "total bytes communicated (received + sent): " << socket->GetBytesSent() + socket->GetBytesReceived() << endl;


  socket->Close();

  delete socket;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x2270
orl $-0x1, (%rax)
andq $0x0, 0x18(%rax)
vxorps %xmm0, %xmm0, %xmm0
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
vmovups %xmm0, 0x8(%rax)
callq 0x3479
testb %al, %al
je 0x3070
leaq 0x3148(%rip), %rsi      # 0x604b
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2100
leaq 0x68(%rsp), %rdi
callq 0x2e2c
leaq 0x68(%rsp), %rdi
callq 0x2110
callq 0x2050
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %rax, %r14
callq 0x2340
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x2340
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x25cc
leaq 0x28(%rsp), %rdi
callq 0x2110
leaq 0x48(%rsp), %rdi
callq 0x2110
callq 0x2050
movq %rax, %r15
leaq 0x3117(%rip), %rsi      # 0x6094
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2100
leaq 0x68(%rsp), %rdi
callq 0x2e2c
subq %r14, %r15
leaq 0x68(%rsp), %rdi
vcvtsi2ss %r15, %xmm1, %xmm0
vdivss 0x3059(%rip), %xmm0, %xmm0 # 0x6004
vmovss %xmm0, 0x4(%rsp)
callq 0x2110
movq 0x601b(%rip), %r14      # 0x8fd8
leaq 0x30ed(%rip), %rsi      # 0x60b1
movq %r14, %rdi
callq 0x2250
vmovss 0x4(%rsp), %xmm0
movq %rax, %rdi
callq 0x21a0
leaq 0x30ea(%rip), %rsi      # 0x60cb
movq %rax, %rdi
callq 0x2250
movq %rax, %rdi
callq 0x2130
leaq 0x30dc(%rip), %rsi      # 0x60d4
movq %r14, %rdi
callq 0x2250
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x2130
leaq 0x30cc(%rip), %rsi      # 0x60e7
movq %r14, %rdi
callq 0x2250
movq 0x10(%rbx), %rsi
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x2130
leaq 0x30c0(%rip), %rsi      # 0x60fe
movq %r14, %rdi
callq 0x2250
movq 0x10(%rbx), %rsi
movq %rax, %rdi
addq 0x8(%rbx), %rsi
callq 0x2180
movq %rax, %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x331c
movq %rbx, %rdi
callq 0x2230
jmp 0x30df
leaq 0x68(%rsp), %rdi
callq 0x2190
leaq 0x78(%rsp), %rdi
leaq 0x2fe6(%rip), %rsi      # 0x606c
callq 0x2250
movq %rax, %rdi
movl %ebp, %esi
callq 0x23d0
leaq 0x2feb(%rip), %rsi      # 0x6087
movq %rax, %rdi
callq 0x2250
movq %rax, %rdi
movq %r14, %rsi
callq 0x2250
leaq 0x80(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x2390
leaq 0x8(%rsp), %rdi
callq 0x2e2c
leaq 0x8(%rsp), %rdi
callq 0x2110
leaq 0x68(%rsp), %rdi
callq 0x21b0
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
movq %rax, %rbx
callq 0x2110
jmp 0x3134
jmp 0x311d
jmp 0x3131
jmp 0x312c
leaq 0x28(%rsp), %rdi
movq %rax, %rbx
callq 0x2110
jmp 0x3116
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x3125
leaq 0x68(%rsp), %rdi
movq %rax, %rbx
callq 0x2110
jmp 0x313e
movq %rax, %rbx
jmp 0x313e
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x23e0