Function at 0x40ac53
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 0x40b36e
test dword [0x40e3c8], 0x80000000
je 0x40ad0c
push ecx
push 0x403724
call dword [sym.imp.msvcrt.dll_printf]
push 1
call fcn.0040cd89
mov edx, dword [ebp - 0x120]
add esp, 0xc
push eax
push ecx
mov ecx, dword [ebp - 0x128]
lea edx, [edx + ecx]
call fcn.004050d2
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 0x40ad31
mov edi, 0x3500
mov word [esi + 2], di
mov edi, dword [ebp - 0x11c]
cmp eax, 0x17
jne 0x40ad3f
mov eax, 0x3500
mov word [esi + 2], ax
test byte [0x40e3c8], 8
jne 0x40ad54
cmp ecx, 0x200
jg 0x40ad54
xor ecx, ecx
jmp 0x40ad57
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 0x40b330
test ecx, ecx
jne 0x40af67
cmp dword [0x4116d4], 0xffffffff
jne 0x40adc9
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 0x40adc9
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b25e
push 0x403788
jmp 0x40afb3
cmp dword [ebp - 0x124], 0
jne 0x40adf1
push dword [esi + 0x20]
push esi
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
je 0x40ae36
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 0x40b04e
mov eax, dword [0x40e3c0]
mov dword [ebp - 0x144], eax
test eax, eax
jg 0x40ae2d
mov dword [ebp - 0x144], 1
and dword [ebp - 0x140], 0
jmp 0x40ae54
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b25e
push 0x40379c
jmp 0x40afb3
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 0x40b023
je 0x40afd4
push 0
push 0x10000
push edi
push dword [0x4116d4]
call dword [sym.imp.WS2_32.dll_recv]
mov edi, eax
test edi, edi
je 0x40afbf
cmp edi, 0xffffffff
je 0x40afbf
mov ecx, dword [ebp - 0x11c]
mov eax, dword [ebp - 0x148]
mov dword [ebp - 0x138], 1
cmp ax, word [ecx]
je 0x40af13
test dword [0x40e3c8], 0x80000000
je 0x40ae52
push 0x40380c
call dword [sym.imp.msvcrt.dll_printf]
push 1
call fcn.0040cd89
mov edx, dword [ebp - 0x11c]
pop ecx
pop ecx
push eax
lea edx, [edx + edi]
mov edi, dword [ebp - 0x11c]
push ecx
mov ecx, edi
call fcn.004050d2
jmp 0x40ae54
mov eax, dword [0x40e3c8]
test al, 0x20
jne 0x40b2b0
mov edx, dword [ebp - 0x118]
test byte [ecx + 2], dl
je 0x40b2b0
test dl, al
je 0x40af3f
push 0x403828
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 0x40b0b2
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 0x40b06a
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b25e
push 0x403748
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
jmp 0x40b25e
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b03d
push 0x403800
jmp 0x40b036
push 0x4037b4
call dword [sym.imp.msvcrt.dll_printf]
push dword [ebp - 0x144]
push 0x4037cc
call dword [sym.imp.msvcrt.dll_printf]
mov eax, dword [ebp - 0x118]
add esp, 0xc
test byte [0x40e3c8], al
je 0x40b014
push dword [ebp - 0x144]
push 0x4037ec
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
pop ecx
mov dword [ebp - 0x138], 1
jmp 0x40b25e
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b03d
push 0x4037ac
call dword [sym.imp.msvcrt.dll_perror]
pop ecx
call fcn.0040b386
and dword [ebp - 0x124], 0
jmp 0x40b25e
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b25e
push 0x4037a4
jmp 0x40afb3
push dword [esi + 0x20]
push esi
push eax
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x40b0b2
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b09a
push 0x40375c
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 0x40b25e
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 0x40b289
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 0x40b289
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 0x40b14a
mov ax, word [ebp - 0x114]
add edi, esi
sub ax, si
mov word [ebp - 0x114], ax
movzx eax, ax
jne 0x40b119
cmp esi, 0xffffffff
jne 0x40b1af
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov esi, eax
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b171
push 0x40377c
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 0x40b258
cmp dword [ebp - 0x13c], 0
mov esi, dword [ebp - 0x12c]
jne 0x40b25e
mov dword [ebp - 0x13c], 1
jmp 0x40b25e
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 0x40b21c
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 0x40b216
mov ax, word [ebp - 0x114]
add edi, esi
sub ax, si
mov word [ebp - 0x114], ax
movzx eax, ax
jne 0x40b1e5
mov edi, dword [ebp - 0x150]
cmp esi, 0xffffffff
jne 0x40b2ab
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b245
push 0x40377c
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 0x40b330
mov edi, dword [ebp - 0x11c]
mov ecx, dword [ebp - 0x130]
jmp 0x40ad7b
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov eax, dword [ebp - 0x118]
test byte [0x40e3c8], al
je 0x40b09a
push 0x40376c
jmp 0x40b093
mov eax, dword [0x40e3c8]
mov ecx, dword [ebp - 0x118]
test cl, al
je 0x40b311
test eax, eax
jns 0x40b2cd
push edi
push 0x40383c
call dword [sym.imp.msvcrt.dll_printf]
pop ecx
jmp 0x40b2d8
push 0x403864
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 0x40b311
mov esi, eax
add esi, dword [ebp - 0x11c]
push 1
call fcn.0040cd89
pop ecx
push eax
push ecx
mov ecx, dword [ebp - 0x11c]
mov edx, esi
call fcn.004050d2
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 0x40b371
mov eax, dword [0x4116d4]
cmp eax, 0xffffffff
je 0x40b348
push eax
call dword [sym.imp.WS2_32.dll_closesocket]
or dword [0x4116d4], 0xffffffff
cmp dword [ebp - 0x130], 0
jne 0x40b35f
cmp dword [ebp - 0x138], 0
je 0x40b36e
or eax, 0xffffffff
jmp 0x40b371
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x72
je 0x40b36e
push 0xfffffffffffffffd
jmp 0x40b370
push 0xfffffffffffffffb
pop eax
mov ecx, dword [ebp - 4]
pop edi
xor ecx, ebp
pop esi
call fcn.0040c870
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret 0x10