Function at 0x40d320
Capabilities:
Get socket status
Resolve dns
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x5b0
mov eax, dword [0x4b9430]
xor eax, ebp
mov dword [ebp - 8], eax
mov eax, dword [ebp + 8]
push ebx
push esi
push edi
xor edx, edx
xor ebx, ebx
mov edi, ecx
mov dword [ebp - 0x5ac], eax
mov dword [ebp - 0x5a0], edi
mov dword [ebp - 0x51c], edx
mov dword [ebp - 0x5a4], ebx
xor esi, esi
lea esp, [esp]
mov ecx, dword [edi + esi*4]
cmp ecx, 0xffffffff
je 0x40d3aa
xor eax, eax
test edx, edx
je 0x40d37e
mov edi, edi
cmp dword [ebp + eax*4 - 0x518], ecx
je 0x40d37e
inc eax
cmp eax, edx
jb 0x40d370
cmp eax, edx
jne 0x40d39b
cmp edx, 0x40
jae 0x40d39b
mov dword [ebp + eax*4 - 0x518], ecx
mov edx, dword [ebp - 0x51c]
inc edx
mov dword [ebp - 0x51c], edx
lea eax, [ecx + 1]
cmp ebx, eax
jae 0x40d3aa
mov dword [ebp - 0x5a4], eax
mov ebx, eax
inc esi
cmp esi, 2
jl 0x40d360
test ebx, ebx
je 0x40d427
mov esi, dword [sym.imp.WS2_32.dll_select]
push 0
push 0
push 0
lea ecx, [ebp - 0x51c]
push ecx
push ebx
call esi
mov edi, eax
test edi, edi
jns 0x40d3dc
call fcn.00460a98
cmp dword [eax], 4
je 0x40d3ba
test edi, edi
jg 0x40d43a
test edi, edi
jne 0x40d407
push str.Waiting_on_new_client_failed_because_select_2__returned_0._This_should_not_happen.
push 0x2000
call fcn.004090c0
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0045d3b4
mov esp, ebp
pop ebp
ret
call fcn.00460a98
mov edx, dword [eax]
push edx
call fcn.004609ec
push eax
push str.Waiting_on_new_client_failed_because_of_problems_in_select_2_:__s.
push 0x2000
call fcn.004090c0
add esp, 0x10
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0045d3b4
mov esp, ebp
pop ebp
ret
mov ebx, dword [sym.imp.WS2_32.dll___WSAFDIsSet]
xor esi, esi
jmp 0x40d450
mov ecx, dword [ebp - 0x5a0]
mov edx, dword [ecx + esi*4]
lea eax, [ebp - 0x51c]
push eax
push edx
call ebx
test eax, eax
jne 0x40d46f
inc esi
cmp esi, 2
jl 0x40d450
jmp 0x40d474
cmp esi, 2
jl 0x40d4a1
mov eax, dword [ebp - 0x5a4]
push eax
push edi
push str.select_2__reported_connected_clients__number___u__descriptor_boundary___u___but_none_found.
push 0x2000
call fcn.004090c0
add esp, 0x10
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0045d3b4
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 0x5a0]
mov esi, dword [ecx + esi*4]
lea edx, [ebp - 0x5a8]
push edx
lea eax, [ebp - 0x59c]
push eax
push esi
mov dword [ebp - 0x5a8], 0x80
call dword [sym.imp.WS2_32.dll_accept]
mov edi, eax
cmp edi, 0xffffffff
je 0x40d427
push 4
lea eax, [ebp - 0x5a0]
push eax
push 0x80
push 0xffff
push esi
mov dword [ebp - 0x5a0], 0x50001
call dword [sym.imp.WS2_32.dll_setsockopt]
test eax, eax
je 0x40d50f
push edi
push str.Setting_SO_LINGER_on_socket__d_failed.
push 0x2000
call fcn.004090c0
add esp, 0xc
mov edx, dword [ebp - 0x5a8]
mov esi, dword [ebp - 0x5ac]
push 2
push 0
push 0
push 0x401
lea ecx, [ebp - 0x414]
push ecx
push edx
lea eax, [ebp - 0x59c]
push eax
mov dword [esi + 0x84], edi
call dword [sym.imp.WS2_32.dll_getnameinfo]
test eax, eax
je 0x40d55e
push str._unknown_
lea ecx, [ebp - 0x414]
push 0x401
push ecx
call fcn.00460ae1
add esp, 0xc
lea edx, [ebp - 0x414]
push edx
call fcn.004734c7
mov ecx, dword [ebp - 8]
mov dword [esi + 0xdc], eax
movzx eax, word [ebp - 0x59a]
add esp, 4
pop edi
mov dword [esi + 0xe4], eax
pop esi
xor ecx, ebp
mov eax, 1
pop ebx
call fcn.0045d3b4
mov esp, ebp
pop ebp
ret