Function at 0x4165a0
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create tcp socket
Create udp socket
Get socket status
Print debug messages
Resolve dns
Set socket configuration

Disassembly:
sub esp, 0x138
mov eax, dword [0x458ad0]
xor eax, esp
mov dword [esp + 0x130], eax
push ebx
push esi
push edi
push 0
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, 0xffffffff
jne 0x4165f4
mov eax, dword [esp + 0x148]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, esi
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4165ec
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
or eax, 0xffffffff
jmp 0x4167f2
mov edi, dword [sym.imp.WS2_32.dll_setsockopt]
push 4
lea ecx, [esp + 0x10]
push ecx
push 0x1005
push 0xffff
mov ebx, 0x1770
push esi
mov dword [esp + 0x20], ebx
call edi
cmp eax, 0xffffffff
jne 0x416651
push str.____send_socket
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
mov eax, dword [esp + 0x148]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x41664a
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor eax, eax
jmp 0x4167f2
push 4
lea ecx, [esp + 0x10]
push ecx
push 0x1006
push 0xffff
push esi
mov dword [esp + 0x20], ebx
call edi
cmp eax, 0xffffffff
jne 0x4166a3
push str.____rev_socket
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
mov eax, dword [esp + 0x148]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x41664a
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor eax, eax
jmp 0x4167f2
mov ebx, dword [sym.imp.WS2_32.dll_ioctlsocket]
lea ecx, [esp + 0x14]
push ecx
push 0x8004667e
push esi
mov dword [esp + 0x20], 1
call ebx
cmp eax, 0xffffffff
je 0x416627
mov edx, dword [esp + 0x148]
mov ecx, 2
push edx
mov word [esp + 0x130], cx
call dword [sym.imp.WS2_32.dll_gethostbyname]
test eax, eax
jne 0x416701
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
lea ecx, [esp + 0x148]
call fcn.00403400
or eax, 0xffffffff
jmp 0x4167f2
movsx ecx, word [eax + 0xa]
mov edx, dword [eax + 0xc]
mov eax, dword [edx]
push ecx
push eax
lea ecx, [esp + 0x138]
push ecx
call fcn.0042e0e0
mov edi, dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
add esp, 0xc
push 0x44f420
call edi
mov edx, dword [esp + 0x14c]
push edx
call dword [sym.imp.WS2_32.dll_htons]
mov word [esp + 0x12e], ax
push 0x10
lea eax, [esp + 0x130]
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
push str.____
call edi
xor edi, edi
lea ecx, [esp + 0x18]
push ecx
push edi
lea edx, [esp + 0x28]
push edx
push edi
push edi
mov dword [esp + 0x38], esi
mov dword [esp + 0x34], 1
mov dword [esp + 0x2c], 0xa
mov dword [esp + 0x30], edi
call dword [sym.imp.WS2_32.dll_select]
test eax, eax
jg 0x4167ab
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, dword [esp + 0x148]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jmp 0x41663e
lea ecx, [esp + 0x10]
push ecx
push 0x8004667e
push esi
mov dword [esp + 0x1c], edi
call ebx
cmp eax, 0xffffffff
jne 0x4167cd
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x416627
mov eax, dword [esp + 0x148]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4167f0
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, esi
mov ecx, dword [esp + 0x13c]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.00428e93
add esp, 0x138
ret 8