Function at 0x404060
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Create tcp socket
Receive data
Receive data on socket
Send data
Send data on socket
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x24
mov eax, ecx
mov dword [esp + 0x14], 0
push ebx
push esi
push edi
cmp dword [eax + 0x34], 0
mov dword [esp + 0x24], eax
jbe 0x4042a9
mov ebx, dword [ebp + 0xc]
mov ecx, dword [ebx]
test ecx, ecx
je 0x404099
mov eax, dword [ecx]
push 1
call dword [eax]
mov dword [ebx], 0
mov ecx, dword [ebp + 8]
lea eax, [esp + 0x28]
xorps xmm0, xmm0
lea edx, [esp + 0x18]
xor edi, edi
movlpd qword [esp + 0x28], xmm0
push eax
mov dword [esp + 0x1c], edi
call fcn.004078a0
add esp, 4
test al, al
je 0x404174
mov ebx, dword [esp + 0x28]
lea eax, [ebx + 4]
push eax
call fcn.004759b9
add esp, 4
mov esi, eax
mov dword [esp + 0x14], esi
push ebx
call dword [sym.imp.WS2_32.dll_htonl]
mov dword [esi], eax
mov eax, dword [esp + 0x14]
mov esi, dword [esp + 0x18]
add eax, 4
push ebx
push esi
push eax
call fcn.004790b0
add esp, 0xc
test esi, esi
je 0x404106
push esi
call fcn.004759e5
add esp, 4
push 6
push 1
push 2
add ebx, 4
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, 0xffffffff
je 0x404171
push 4
lea eax, [esp + 0x20]
mov dword [esp + 0x20], 0x1388
push eax
push 0x1005
push 0xffff
push esi
call dword [sym.imp.WS2_32.dll_setsockopt]
push 4
lea eax, [esp + 0x20]
push eax
push 0x1006
push 0xffff
push esi
call dword [sym.imp.WS2_32.dll_setsockopt]
mov eax, dword [esp + 0x24]
push 0x10
add eax, 4
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x404198
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
mov ebx, dword [ebp + 0xc]
or edi, 0xffffffff
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x24]
inc eax
mov dword [esp + 0x20], eax
cmp eax, dword [ecx + 0x34]
jb 0x404087
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
push 0
push ebx
push dword [esp + 0x1c]
mov dword [esp + 0x24], edi
push esi
call dword [sym.imp.WS2_32.dll_send]
test eax, eax
jg 0x4041b9
mov ebx, dword [ebp + 0xc]
or edi, 0xffffffff
jmp 0x404244
push 0
push 4
lea eax, [esp + 0x18]
mov dword [esp + 0x18], edi
push eax
push esi
call dword [sym.imp.WS2_32.dll_recv]
mov ecx, dword [esp + 0x10]
mov edx, eax
lea eax, [ecx - 1]
cmp eax, 0xfffffff
ja 0x404216
push ecx
call fcn.004759b9
add esp, 4
mov ebx, eax
mov dword [esp + 0x18], ebx
push dword [esp + 0x10]
push 0
push ebx
call fcn.004773d0
add esp, 0xc
push 0
push dword [esp + 0x14]
push ebx
push esi
call dword [sym.imp.WS2_32.dll_recv]
mov edx, eax
test edx, edx
mov ecx, edx
cmovle ecx, dword [esp + 0x10]
jmp 0x404218
mov ebx, edi
test ecx, ecx
jg 0x404226
mov ebx, dword [ebp + 0xc]
mov edi, 0xfffffffe
jmp 0x404244
mov eax, edx
mov ecx, ebx
cdq
push edx
push eax
call fcn.004079b0
mov ebx, dword [ebp + 0xc]
add esp, 8
test eax, eax
mov dword [ebx], eax
mov eax, 0xfffffffd
cmove edi, eax
push 1
push dword [esp + 0x18]
call fcn.00475891
mov eax, dword [esp + 0x20]
add esp, 8
test eax, eax
je 0x404265
push 1
push eax
call fcn.00475891
add esp, 8
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
test edi, edi
jne 0x404177
push edi
push 0x4fa4b0
push 0x4fa498
push edi
push dword [ebx]
call fcn.004b6a4a
add esp, 0x14
test eax, eax
je 0x40429f
mov eax, dword [eax + 0x5c]
cmp eax, 0x7d0
jge 0x40429f
cmp eax, 0x3e8
jge 0x4042a9
mov edi, 0xfffffc17
jmp 0x404177
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 8