// File: jBlinden[P]private-codis/ProtocolServer.cpp
// Function: StartServer(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 StartServer(int port, string pArgsFile, string serverDataDir)
{
  CSocket *socket = new CSocket();
  if (Listen(socket, port))
  {
    ServerLog("accepted connection from client");
  }
  else
  {
    stringstream ss;
    ss << "failed to listen for client connections on port " << port;
    ServerLog(ss.str());
    return;
  }

  RunServerProtocol(socket, pArgsFile, serverDataDir);

  ServerLog("protocol execution completed");

  cout << endl
       << "bytes sent: " << socket->GetBytesSent() << endl;
  cout << "bytes received: " << socket->GetBytesReceived() << endl;

  socket->Close();

  delete socket;
}

// Assembly:
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rsi, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movl %edi, 0x2b4(%rsp)
movq %rsi, 0x2a8(%rsp)
movq %rdx, 0x2a0(%rsp)
movl $0x20, %edi
callq 0x2270
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x48(%rsp)
callq 0x4630
jmp 0x3e74
movq 0x48(%rsp), %rax
movq %rax, 0x298(%rsp)
movq 0x298(%rsp), %rdi
movl 0x2b4(%rsp), %esi
callq 0x46e0
testb $0x1, %al
jne 0x3e9e
jmp 0x3f65
leaq 0x267(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x2420
movq 0x30(%rsp), %rdx
leaq 0x5170(%rip), %rsi      # 0x902c
leaq 0x268(%rsp), %rdi
callq 0x2350
jmp 0x3ecb
leaq 0x268(%rsp), %rdi
callq 0x3d90
jmp 0x3eda
leaq 0x268(%rsp), %rdi
callq 0x2170
leaq 0x267(%rsp), %rdi
callq 0x22b0
jmp 0x402e
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
callq 0x2220
jmp 0x4221
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x3f53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0x268(%rsp), %rdi
callq 0x2170
leaq 0x267(%rsp), %rdi
callq 0x22b0
jmp 0x4221
leaq 0xd8(%rsp), %rdi
callq 0x2180
leaq 0xe8(%rsp), %rdi
leaq 0x50cb(%rip), %rsi      # 0x904c
callq 0x2250
movq %rax, 0x28(%rsp)
jmp 0x3f8d
movq 0x28(%rsp), %rdi
movl 0x2b4(%rsp), %esi
callq 0x2400
jmp 0x3fa0
leaq 0xb8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x2240
jmp 0x3fb7
leaq 0xb8(%rsp), %rdi
callq 0x3d90
jmp 0x3fc6
leaq 0xb8(%rsp), %rdi
callq 0x2170
leaq 0xd8(%rsp), %rdi
callq 0x2190
jmp 0x4198
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x401c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x2170
leaq 0xd8(%rsp), %rdi
callq 0x2190
jmp 0x4221
movq 0x38(%rsp), %rsi
movq 0x298(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x2110
movq 0x40(%rsp), %rsi
leaq 0x78(%rsp), %rdi
callq 0x2110
jmp 0x405e
movq 0x20(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x2650
jmp 0x4077
leaq 0x78(%rsp), %rdi
callq 0x2170
leaq 0x98(%rsp), %rdi
callq 0x2170
leaq 0x57(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x2420
movq 0x18(%rsp), %rdx
leaq 0x4fd4(%rip), %rsi      # 0x907d
leaq 0x58(%rsp), %rdi
callq 0x2350
jmp 0x40b5
leaq 0x58(%rsp), %rdi
callq 0x3d90
jmp 0x40c1
leaq 0x58(%rsp), %rdi
callq 0x2170
leaq 0x57(%rsp), %rdi
callq 0x22b0
movq 0x7efc(%rip), %rdi      # 0xbfd8
movq 0x7edd(%rip), %rsi      # 0xbfc0
callq 0x22a0
movq %rax, %rdi
leaq 0x4fa8(%rip), %rsi      # 0x909a
callq 0x2250
movq %rax, (%rsp)
movq 0x298(%rsp), %rdi
callq 0x4660
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x2090
movq %rax, %rdi
movq 0x7ea2(%rip), %rsi      # 0xbfc0
callq 0x22a0
movq 0x7eae(%rip), %rdi      # 0xbfd8
leaq 0x4f76(%rip), %rsi      # 0x90a7
callq 0x2250
movq %rax, 0x8(%rsp)
movq 0x298(%rsp), %rdi
callq 0x4670
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x2090
movq %rax, %rdi
movq 0x7e61(%rip), %rsi      # 0xbfc0
callq 0x22a0
movq 0x298(%rsp), %rdi
callq 0x4680
movq 0x298(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x4198
movq 0x10(%rsp), %rdi
callq 0x46d0
movq 0x10(%rsp), %rdi
callq 0x2220
addq $0x2b8, %rsp            # imm = 0x2B8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x41d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x2170
leaq 0x98(%rsp), %rdi
callq 0x2170
jmp 0x4221
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x4217
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x2170
leaq 0x57(%rsp), %rdi
callq 0x22b0
movq 0x290(%rsp), %rdi
callq 0x2410
nop