// File: /workspace/github_cpp_makefile_star2_O1/tylerkaraszewski[P]Argyle/Server.cpp
// Function: Server::bindPort()
bool Server::bindPort()
{
  m_mainSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (m_mainSocket == -1)
  {
    m_logger.logError("Socket error(" + Utils::llToString(errno) + "): " + strerror(errno));
    return false;
  }

  int reuseAddr = 1;
  if (setsockopt(m_mainSocket, SOL_SOCKET, SO_REUSEADDR, (char*)&reuseAddr, sizeof(reuseAddr)))
  {
    m_logger.logError("Setsockopt error(" + Utils::llToString(errno) + "): " + strerror(errno));
    close(m_mainSocket);
    return false;
  }
  
  if (bind(m_mainSocket, (struct sockaddr*)&m_address, sizeof(m_address)))
  {
    m_logger.logError("Bind error(" + Utils::llToString(errno) + "): " + strerror(errno));
    close(m_mainSocket);
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
movl $0x2, %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x30b0
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0x3b42
leaq 0x84(%rsp), %rcx
movl $0x1, (%rcx)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x3530
testl %eax, %eax
je 0x3ba5
movq 0x58(%rbx), %r14
callq 0x3040
movq %rax, %r15
movslq (%rax), %rsi
leaq 0x60(%rsp), %r12
movq %r12, %rdi
callq 0xac34
leaq 0x852f(%rip), %rcx      # 0xc032
movl $0x11, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32e0
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3c1f
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3c27
movq 0x58(%rbx), %rbx
callq 0x3040
movq %rax, %r14
movslq (%rax), %rsi
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0xac34
leaq 0x84bb(%rip), %rcx      # 0xc020
movl $0xd, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32e0
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3d02
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3d0a
movl (%rbx), %edi
leaq 0x48(%rbx), %rsi
movl $0x10, %edx
callq 0x3090
testl %eax, %eax
je 0x3e48
movq 0x58(%rbx), %r14
callq 0x3040
movq %rax, %r15
movslq (%rax), %rsi
leaq 0x60(%rsp), %r12
movq %r12, %rdi
callq 0xac34
leaq 0x8464(%rip), %rcx      # 0xc044
movl $0xb, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32e0
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3e4f
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3e57
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x83e6(%rip), %rsi      # 0xc02e
callq 0x3560
leaq 0x30(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3c74
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3c7b
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %r12
movq %rdx, 0x8(%r12)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl (%r15), %edi
callq 0x3120
movq %r12, %rdi
movq %rax, %rsi
callq 0x3560
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3cd2
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x3cd9
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
callq 0xac26
jmp 0x3f2d
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x8303(%rip), %rsi      # 0xc02e
callq 0x3560
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3d57
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3d5f
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %r15
movq %rdx, 0x8(%r15)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl (%r14), %edi
callq 0x3120
movq %r15, %rdi
movq %rax, %rsi
callq 0x3560
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3db5
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x3dbc
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
callq 0xac26
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x3df7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e0e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x3e24
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f93
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x3f93
movb $0x1, %al
jmp 0x3f95
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x81b6(%rip), %rsi      # 0xc02e
callq 0x3560
leaq 0x30(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3ea4
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3eab
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %r12
movq %rdx, 0x8(%r12)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl (%r15), %edi
callq 0x3120
movq %r12, %rdi
movq %rax, %rsi
callq 0x3560
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3f02
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x3f09
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
callq 0xac26
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f44
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3f5b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3f71
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f8c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3290
movl (%rbx), %edi
callq 0x3580
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3ffd
jmp 0x4019
jmp 0x4035
jmp 0x4050
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x3fd4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x3fd4
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x3ff0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x3ff0
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
jne 0x4041
jmp 0x4053
jmp 0x4050
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x401c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x401c
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4038
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x4038
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x4053
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x4053
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x406e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3520