// File: /workspace/github_cpp_makefile_star2_O2/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 $0x58, %rsp
movq %rdi, %rbx
andq $0x0, (%rdi)
movq %rsi, %r13
movl (%rdx), %eax
movl %eax, 0x8(%rdi)
leaq 0xc(%rdi), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0xbaa0
leaq 0x308b(%rip), %rsi      # 0x1078c
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbc30
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %r13, %rdx
callq 0xba60
leaq 0x18(%rbx), %r15
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rbx)
movups 0x10(%rsp), %xmm0
movups %xmm0, 0x20(%rbx)
andl $0x0, 0x18(%rbx)
leaq 0x30(%rsp), %rdi
callq 0xb250
leaq 0x48(%rbx), %r12
movq %r12, %rdi
callq 0xb570
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 0xd7ef
leaq 0x2fe0(%rip), %rsi      # 0x10797
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xbc30
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0xbc90
leaq 0x30(%rsp), %rsi
movq %r15, %rdi
callq 0xb920
leaq 0x10(%rsp), %rdi
callq 0xb250
movq %r14, %rdi
movq %r15, %rsi
callq 0xb2f0
movl (%r14), %edi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
callq 0xb780
cmpl $-0x1, %eax
je 0xd861
movq 0x7735(%rip), %rax      # 0x14f48
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
leaq 0x8(%rsp), %rdx
movq %rbx, (%rdx)
leaq 0x10(%rsp), %rdi
callq 0xba00
leaq 0x10(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0xbbd0
movq %r13, %rdi
callq 0xbb10
movq %rbx, %rdi
callq 0xbcc0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0xb2a0
movq %rax, %rbp
leaq 0x10(%rsp), %rdi
callq 0xb460
leaq 0x2f26(%rip), %rsi      # 0x107a3
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xbc20
movb $0x1, %al
movl %eax, 0x4(%rsp)
leaq 0x30(%rsp), %rsi
movq %rbp, %rdi
callq 0xbb90
movl $0x0, 0x4(%rsp)
movq 0x7742(%rip), %rsi      # 0x14ff0
movq 0x7683(%rip), %rdx      # 0x14f38
movq %rbp, %rdi
callq 0xbc50
movq %rax, %r13
leaq 0x30(%rsp), %rdi
callq 0xb250
jmp 0xd8d5
movq %rax, %r13
movb $0x1, %al
movl %eax, 0x4(%rsp)
leaq 0x10(%rsp), %rdi
callq 0xb250
cmpb $0x0, 0x4(%rsp)
jne 0xd8eb
jmp 0xd929
movq %rax, %r13
movq %rbp, %rdi
callq 0xb430
jmp 0xd929
jmp 0xd926
jmp 0xd926
movq %rax, %r13
leaq 0x10(%rsp), %rdi
callq 0xb250
jmp 0xd929
movq %rax, %r13
jmp 0xd93a
movq %rax, %r13
leaq 0x30(%rsp), %rdi
callq 0xb250
jmp 0xd942
movq %rax, %r13
jmp 0xd942
movq %rax, %r13
jmp 0xd94a
movq %rax, %r13
leaq 0x70(%rbx), %rdi
callq 0xb740
movq %r12, %rdi
callq 0xb7e0
movq %r15, %rdi
callq 0xba40
movq %r14, %rdi
callq 0xb700
movq %rbx, %rdi
callq 0xbb10
movq %r13, %rdi
callq 0xbcf0