Function at 0x40a8fb
Capabilities:
Connect socket
Get socket status
Receive data
Receive data on socket
Send data
Send data on socket

Disassembly:
mov edi, edi
push ebx
mov ebx, esp
push ecx
push ecx
and esp, 0xfffffff8
add esp, 4
push ebp
mov ebp, dword [ebx + 4]
mov dword [esp + 4], ebp
mov ebp, esp
sub esp, 0x158
mov eax, dword [0x40e2a4]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebx + 0x14]
push esi
mov esi, ecx
mov dword [ebp - 0x154], eax
mov ecx, dword [ebx + 8]
xor eax, eax
mov dword [ebp - 0x128], edx
mov dword [ebp - 0x12c], esi
mov dword [ebp - 0x120], ecx
mov dword [ebp - 0x138], eax
mov dword [ebp - 0x124], eax
mov dword [ebp - 0x13c], eax
mov word [ebp - 0x114], ax
push edi
mov edi, dword [ebx + 0xc]
mov dword [ebp - 0x11c], edi
test esi, esi
je 0x40b016
test dword [0x40e3c8], 0x80000000
je 0x40a9b4
push ecx
push 0x4036ec
call dword [sym.imp.msvcrt.dll_printf]
push 1
call fcn.0040ccf9
mov edx, dword [ebp - 0x120]
add esp, 0xc
push eax
push ecx
mov ecx, dword [ebp - 0x128]
lea edx, [edx + ecx]
call fcn.00404ec9
mov ecx, dword [ebp - 0x120]
mov edx, dword [ebp - 0x128]
movzx eax, word [esi]
mov dword [ebp - 0x118], 2
cmp ax, word [ebp - 0x118]
jne 0x40a9d9
mov edi, 0x3500
mov word [esi + 2], di
mov edi, dword [ebp - 0x11c]
cmp eax, 0x17
jne 0x40a9e7
mov eax, 0x3500
mov word [esi + 2], ax
test byte [0x40e3c8], 8
jne 0x40a9fc
cmp ecx, 0x200
jg 0x40a9fc
xor ecx, ecx
jmp 0x40a9ff
xor ecx, ecx
inc ecx
movzx eax, word [edx]
mov dword [ebp - 0x148], eax
xor eax, eax
mov dword [ebp - 0x134], eax
mov eax, dword [0x40e3c4]
mov dword [ebp - 0x130], ecx
test eax, eax
jle 0x40afd8
test ecx, ecx
jne 0x40ac0f
cmp dword [0x4116d4], 0xffffffff
jne 0x40aa71
movzx eax, word [esi]
push ecx
push dword [ebp - 0x118]
push eax
call dword [sym.imp.WS2_32.dll_socket]
mov dword [0x4116d4], eax
cmp eax, 0xffffffff
jne 0x40aa71
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40af06
push 0x403750
jmp 0x40ac5b
cmp dword [ebp - 0x124], 0
jne 0x40aa99
push dword [esi + 0x20]
push esi
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
je 0x40aade
mov dword [ebp - 0x124], 1
push 0
push dword [ebp - 0x120]
push dword [ebp - 0x128]
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_send]
cmp eax, 0xffffffff
je 0x40acf6
mov eax, dword [0x40e3c0]
mov dword [ebp - 0x144], eax
test eax, eax
jg 0x40aad5
mov dword [ebp - 0x144], 1
and dword [ebp - 0x140], 0
jmp 0x40aafc
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40af06
push 0x403764
jmp 0x40ac5b
mov edi, ecx
mov eax, dword [0x4116d4]
lea ecx, [ebp - 0x144]
push ecx
push 0
push 0
lea ecx, [ebp - 0x110]
mov dword [ebp - 0x10c], eax
push ecx
push eax
mov dword [ebp - 0x110], 1
call dword [sym.imp.WS2_32.dll_select]
test eax, eax
js 0x40accb
je 0x40ac7c
push 0
push 0x10000
push edi
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_recv]
mov edi, eax
test edi, edi
je 0x40ac67
cmp edi, 0xffffffff
je 0x40ac67
mov ecx, dword [ebp - 0x11c]
mov eax, dword [ebp - 0x148]
mov dword [ebp - 0x138], 1
cmp ax, word [ecx]
je 0x40abbb
test dword [0x40e3c8], 0x80000000
je 0x40aafa
push 0x4037d4
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
push 1
call fcn.0040ccf9
mov edx, dword [ebp - 0x11c]
pop ecx
push eax
push ecx
lea edx, [edx + edi]
mov edi, dword [ebp - 0x11c]
mov ecx, edi
call fcn.00404ec9
jmp 0x40aafc
mov eax, dword [0x40e3c8]
test al, 0x20
jne 0x40af58
mov edx, dword [ebp - 0x118]
test byte [ecx + 2], dl
je 0x40af58
test dl, al
je 0x40abe7
push 0x4037f0
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x4116d4], 0xffffffff
mov eax, dword [0x40e3c4]
mov edi, dword [ebp - 0x11c]
mov dword [ebp - 0x130], 1
cmp dword [0x4116d4], 0xffffffff
mov dword [ebp - 0x134], eax
jne 0x40ad5a
movzx eax, word [esi]
push 0
push 1
push eax
call dword [sym.imp.WS2_32.dll_socket]
mov dword [0x4116d4], eax
cmp eax, 0xffffffff
jne 0x40ad12
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40af06
push 0x403710
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
jmp 0x40af06
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40ace5
push 0x4037c8
jmp 0x40acde
push 0x40377c
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
push dword [ebp - 0x144]
push 0x403794
call dword [sym.imp.msvcrt.dll_printf]
mov eax, dword [ebp - 0x118]
pop ecx
pop ecx
test byte [0x40e3c8], al
je 0x40acbc
push dword [ebp - 0x144]
push 0x4037b4
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
pop ecx
mov dword [ebp - 0x138], 1
jmp 0x40af06
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40ace5
push 0x403774
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
call fcn.0040b02e
and dword [ebp - 0x124], 0
jmp 0x40af06
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40af06
push 0x40376c
jmp 0x40ac5b
push dword [esi + 0x20]
push esi
push eax
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x40ad5a
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40ad42
push 0x403724
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x4116d4], 0xffffffff
jmp 0x40af06
push dword [ebp - 0x120]
call dword [sym.imp.WS2_32.dll_htons]
push 0
push dword [ebp - 0x118]
mov word [ebp - 0x114], ax
lea eax, [ebp - 0x114]
push eax
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_send]
cmp eax, 0xffffffff
je 0x40af31
push 0
push dword [ebp - 0x120]
push dword [ebp - 0x128]
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_send]
cmp eax, 0xffffffff
je 0x40af31
mov eax, dword [ebp - 0x118]
mov word [ebp - 0x114], ax
push 0
movzx eax, ax
push eax
push edi
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_recv]
mov esi, eax
test esi, esi
jle 0x40adf2
mov ax, word [ebp - 0x114]
add edi, esi
sub ax, si
mov word [ebp - 0x114], ax
movzx eax, ax
jne 0x40adc1
cmp esi, 0xffffffff
jne 0x40ae57
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov esi, eax
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40ae19
push 0x403744
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x4116d4], 0xffffffff
cmp esi, 0x6f
jne 0x40af00
cmp dword [ebp - 0x13c], 0
mov esi, dword [ebp - 0x12c]
jne 0x40af06
mov dword [ebp - 0x13c], 1
jmp 0x40af06
mov eax, dword [ebp - 0x11c]
mov dword [ebp - 0x14c], eax
movzx eax, word [eax]
push eax
call dword [sym.imp.WS2_32.dll_ntohs]
movzx edi, ax
movzx eax, di
mov ecx, eax
mov dword [ebp - 0x150], edi
mov word [ebp - 0x114], ax
test cx, cx
je 0x40aec4
mov edi, dword [ebp - 0x14c]
push 0
movzx eax, ax
push eax
push edi
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_recv]
mov esi, eax
test esi, esi
jle 0x40aebe
mov ax, word [ebp - 0x114]
add edi, esi
sub ax, si
mov word [ebp - 0x114], ax
movzx eax, ax
jne 0x40ae8d
mov edi, dword [ebp - 0x150]
cmp esi, 0xffffffff
jne 0x40af53
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40aeed
push 0x403744
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x4116d4], 0xffffffff
mov esi, dword [ebp - 0x12c]
mov edx, dword [ebp - 0x134]
mov eax, dword [0x40e3c4]
inc edx
mov dword [ebp - 0x134], edx
cmp edx, eax
jge 0x40afd8
mov edi, dword [ebp - 0x11c]
mov ecx, dword [ebp - 0x130]
jmp 0x40aa23
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40ad42
push 0x403734
jmp 0x40ad3b
mov eax, dword [0x40e3c8]
mov ecx, dword [ebp - 0x118]
test cl, al
je 0x40afb9
test eax, eax
jns 0x40af75
push edi
push 0x403804
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
jmp 0x40af80
push 0x40382c
call dword [sym.imp.msvcrt.dll_printf]
cmp edi, 0x10000
pop ecx
sbb eax, eax
and eax, edi
movzx eax, ax
mov word [ebp - 0x114], ax
cmp eax, 0xc
jb 0x40afb9
mov esi, eax
add esi, dword [ebp - 0x11c]
push 1
call fcn.0040ccf9
pop ecx
push eax
push ecx
mov ecx, dword [ebp - 0x11c]
mov edx, esi
call fcn.00404ec9
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, dword [ebp - 0x154]
or dword [0x4116d4], 0xffffffff
mov dword [eax], edi
xor eax, eax
jmp 0x40b019
mov eax, dword [0x4116d4]
cmp eax, 0xffffffff
je 0x40aff0
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x4116d4], 0xffffffff
cmp dword [ebp - 0x130], 0
jne 0x40b007
cmp dword [ebp - 0x138], 0
je 0x40b016
or eax, 0xffffffff
jmp 0x40b019
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x72
je 0x40b016
push 0xfffffffffffffffd
jmp 0x40b018
push 0xfffffffffffffffb
pop eax
mov ecx, dword [ebp - 4]
pop edi
xor ecx, ebp
pop esi
call fcn.0040c730
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret 0x10