// File: /workspace/github_cpp_makefile_star2_O3/dak98[P]SocketIO/src/server.cpp
// Function: socket_io::server::server(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, socket_io::ip_protocol const&)
server::server(std::string const& port, ip_protocol const& ip_version)
    : ip_version{ip_version}, main_socket{ip_version},
      address_of_server{ipv4_socket_address{"INADDR_ANY", port}}
{
    if (this->ip_version == ip_protocol::IPv6)
	address_of_server = ipv6_socket_address{"in6addr_any", port};

    bind(main_socket, address_of_server);
    
    if (listen(main_socket.get_native_handle(),
	       std::numeric_limits<int>::max())	== -1)
	throw std::runtime_error{"An error occured on server start: " +
		                 get_errno_as_string()};

    accept_clients_tid = std::thread(&server::accept_clients, this);
    accept_clients_tid.detach();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r13
movq %rdi, %rbx
movq $0x0, (%rdi)
movl (%rdx), %eax
movl %eax, 0x8(%rdi)
leaq 0xc(%rdi), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x8800
leaq 0x40(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x3d79(%rip), %rsi      # 0xe78c
leaq 0x3d7c(%rip), %rdx      # 0xe796
leaq 0x30(%rsp), %rdi
callq 0x81a0
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %r13, %rdx
callq 0x87c0
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rbx)
movups 0x10(%rsp), %xmm0
movups %xmm0, 0x20(%rbx)
movl $0x0, 0x18(%rbx)
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0xaa66
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x84c0
leaq 0x18(%rbx), %r15
leaq 0x48(%rbx), %rdi
movq %rdi, 0x58(%rsp)
callq 0x83e0
movl $0x64, 0x68(%rbx)
leaq 0xa0(%rbx), %rax
movq %rax, 0x70(%rbx)
movq $0x1, 0x78(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x80(%rbx)
movl $0x3f800000, 0x90(%rbx) # imm = 0x3F800000
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
movups %xmm0, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
movups %xmm0, 0xd8(%rbx)
movups %xmm0, 0xe8(%rbx)
cmpl $0xa, 0x8(%rbx)
jne 0xab2e
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x3cb0(%rip), %rsi      # 0xe797
leaq 0x3cb4(%rip), %rdx      # 0xe7a2
leaq 0x10(%rsp), %rdi
callq 0x81a0
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x8940
leaq 0x30(%rsp), %rsi
movq %r15, %rdi
callq 0x8680
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xab2e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x84c0
movq %r14, %rdi
movq %r15, %rsi
callq 0x8270
movl (%r14), %edi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
callq 0x8550
cmpl $-0x1, %eax
je 0xab9d
movq 0x83f6(%rip), %rax      # 0x12f48
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
leaq 0x60(%rsp), %rdx
movq %rbx, (%rdx)
leaq 0x10(%rsp), %rdi
callq 0x8760
cmpq $0x0, (%rbx)
jne 0xace5
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x8960
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x8220
movq %rax, %r12
leaq 0x10(%rsp), %rdi
callq 0x8350
leaq 0x3be8(%rip), %rsi      # 0xe7a3
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x88e0
movb $0x1, %al
movl %eax, 0xc(%rsp)
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x88a0
movl $0x0, 0xc(%rsp)
movq 0x8404(%rip), %rsi      # 0x12ff0
movq 0x8345(%rip), %rdx      # 0x12f38
movq %r12, %rdi
callq 0x8900
movq %rax, %r13
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0xac15
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x84c0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xac30
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x84c0
cmpb $0x0, 0xc(%rsp)
jne 0xac5c
jmp 0xacb4
movq %rax, %r13
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xac5c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x84c0
jmp 0xac5c
movq %rax, %r13
movq %r12, %rdi
callq 0x8340
jmp 0xacb4
jmp 0xacb1
jmp 0xacb1
movq %rax, %r13
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xacb4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x84c0
jmp 0xacb4
movq %rax, %r13
jmp 0xacc7
movq %rax, %r13
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0xaccf
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x84c0
jmp 0xaccf
movq %rax, %r13
jmp 0xaccf
movq %rax, %r13
jmp 0xacd7
movq %rax, %r13
leaq 0x70(%rbx), %rdi
callq 0x8530
movq 0x58(%rsp), %rdi
callq 0x85a0
movq %r15, %rdi
callq 0x87a0
movq %r14, %rdi
callq 0x8510
cmpq $0x0, (%rbx)
jne 0xace5
movq %r13, %rdi
callq 0x8970
callq 0x8100