Function at 0x4137c0
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create tcp socket
Create udp socket
Get socket status
Resolve dns
Set socket configuration

Disassembly:
sub esp, 0x12c
push ebx
push ebp
push esi
mov esi, dword [esp + 0x13c]
test esi, esi
push edi
mov ebp, ecx
je 0x41388b
cmp dword [esp + 0x144], 1
jl 0x41388b
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
cmp ecx, 1
jb 0x41388b
mov al, byte [ebp + 0xc]
test al, al
je 0x41380c
mov ecx, ebp
call fcn.00413790
push 0
push 1
push 2
call sub.WS2_32.dll_socket
cmp eax, 0xffffffff
mov dword [ebp + 4], eax
je 0x41388b
lea ecx, [ebp + 0x14]
push 4
push ecx
push 0x1006
push 0xffff
push eax
call sub.WS2_32.dll_setsockopt
lea edx, [ebp + 0x18]
push 4
mov ebx, eax
mov eax, dword [ebp + 4]
push edx
push 0x1005
push 0xffff
push eax
call sub.WS2_32.dll_setsockopt
mov edx, dword [ebp + 4]
lea ecx, [esp + 0x10]
push 4
push ecx
push 0x80
push 0xffff
push edx
mov edi, eax
mov word [esp + 0x24], 1
mov word [esp + 0x26], 5
call sub.WS2_32.dll_setsockopt
xor edx, edx
cmp edi, edx
je 0x41389a
cmp ebx, edx
je 0x41389a
mov dword [ebp + 4], 0xffffffff
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x12c
ret 8
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
lea ebx, [ebp + 0x101c]
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov edi, ecx
cmp edi, 0xfffffffd
mov dword [esp + 0x2c], edi
jbe 0x4138be
call fcn.0042e0ea
xor edx, edx
mov ecx, dword [ebx + 4]
cmp ecx, edx
je 0x4138e4
mov al, byte [ecx - 1]
test al, al
je 0x4138e4
cmp al, 0xff
je 0x4138e4
cmp edi, edx
jne 0x413908
dec al
mov byte [ecx - 1], al
mov dword [ebx + 4], edx
mov dword [ebx + 8], edx
mov dword [ebx + 0xc], edx
jmp 0x413938
cmp edi, edx
jne 0x4138f3
push 1
mov ecx, ebx
call fcn.00403320
jmp 0x413938
mov eax, dword [ebx + 0xc]
cmp eax, 0x1f
ja 0x4138ff
cmp eax, edi
jae 0x413910
push 1
mov ecx, ebx
call fcn.00403320
push edi
mov ecx, ebx
call fcn.00403a50
mov ecx, edi
mov edi, dword [ebx + 4]
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x2c]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebx + 4]
mov esi, dword [esp + 0x140]
mov dword [ebx + 8], eax
mov byte [eax + ecx], 0
mov edx, dword [esp + 0x144]
xor eax, eax
mov dword [esp + 0x14], eax
push esi
mov dword [esp + 0x1c], eax
mov dword [ebp + 0x102c], edx
mov dword [esp + 0x20], eax
mov dword [esp + 0x24], eax
call sub.WS2_32.dll_inet_addr
cmp eax, 0xffffffff
jne 0x4139a6
push esi
call sub.WS2_32.dll_gethostbyname
test eax, eax
je 0x413992
movsx ecx, word [eax + 0xa]
mov edx, dword [eax + 0xc]
lea edi, [esp + 0x18]
mov esi, dword [edx]
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ax, word [eax + 8]
mov word [esp + 0x14], ax
jmp 0x4139b1
call sub.WS2_32.dll_WSAGetLastError
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x12c
ret 8
mov word [esp + 0x14], 2
mov dword [esp + 0x18], eax
mov ecx, dword [esp + 0x144]
push ecx
call sub.WS2_32.dll_htons
lea edx, [esp + 0x28]
mov word [esp + 0x16], ax
mov eax, dword [ebp + 4]
push edx
mov esi, 1
push 0x8004667e
push eax
mov dword [esp + 0x34], esi
call sub.WS2_32.dll_ioctlsocket
cmp eax, 0xffffffff
je 0x41388b
mov edi, dword [ebp + 0x10]
mov eax, 0x10624dd3
imul edi
sar edx, 6
mov eax, edx
mov dword [esp + 0x38], esi
shr eax, 0x1f
add edx, eax
mov eax, edi
mov dword [esp + 0x30], edx
mov esi, 0x3e8
cdq
idiv esi
mov ecx, dword [ebp + 4]
push 0x10
mov dword [esp + 0x40], ecx
mov dword [esp + 0x38], edx
lea edx, [esp + 0x18]
push edx
push ecx
call sub.WS2_32.dll_connect
lea eax, [esp + 0x30]
xor esi, esi
push eax
lea ecx, [esp + 0x3c]
push esi
push ecx
push esi
push esi
call sub.WS2_32.dll_select
test eax, eax
jle 0x41388b
mov eax, dword [ebp + 4]
lea edx, [esp + 0x24]
push edx
push 0x8004667e
push eax
mov dword [esp + 0x30], esi
call sub.WS2_32.dll_ioctlsocket
cmp eax, 0xffffffff
jne 0x413a83
mov ecx, dword [ebp + 4]
push ecx
call sub.WS2_32.dll_closesocket
mov dword [ebp + 0x102c], esi
pop edi
mov dword [ebp + 4], 0xffffffff
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x12c
ret 8
pop edi
mov byte [ebp + 0xc], 1
pop esi
pop ebp
mov al, 1
pop ebx
add esp, 0x12c
ret 8