Function at 0x402183
Capabilities:
Connect socket
Get socket status
Resolve dns

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x344
mov eax, dword [0x4d4664]
xor eax, ebp
mov dword [ebp - 4], eax
mov edx, dword [ebp + 0x14]
xor eax, eax
cmp dword [ebp + 8], 1
mov ecx, dword [ebp + 0x18]
push ebx
mov ebx, dword [ebp + 0x20]
push esi
push edi
lea edi, [ebp - 0x14]
stosd dword es:[edi], eax
push 0x10
pop esi
mov dword [ebp - 0x338], esi
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
jne 0x402287
test ebx, ebx
je 0x402413
mov edi, dword [ebp + 0xc]
lea eax, [ebp - 0x338]
push eax
lea eax, [ebp - 0x14]
push eax
push edi
call dword [sym.imp.WS2_32.dll_accept]
xor esi, esi
mov dword [ebx], eax
cmp eax, 0xffffffff
jne 0x402280
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
jne 0x40226b
mov eax, dword [ebp + 0x10]
test eax, eax
jle 0x402279
mov dword [ebp - 0x334], eax
lea eax, [ebp - 0x124]
push eax
push edi
mov dword [ebp - 0x330], esi
mov dword [ebp - 0x120], edi
mov dword [ebp - 0x124], 1
call sub.WS2_32.dll___WSAFDIsSet
lea eax, [ebp - 0x334]
push eax
push esi
push esi
lea eax, [ebp - 0x124]
push eax
push esi
call dword [sym.imp.WS2_32.dll_select]
cmp eax, 1
jne 0x402272
lea eax, [ebp - 0x124]
push eax
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402272
lea eax, [ebp - 0x338]
push eax
lea eax, [ebp - 0x14]
push eax
push edi
call dword [sym.imp.WS2_32.dll_accept]
mov dword [ebx], eax
cmp eax, 0xffffffff
jne 0x402280
push 0xfffffffffffffff6
jmp 0x402415
push 0xfffffffffffffff1
jmp 0x402415
push 0xfffffffffffffff7
jmp 0x402415
mov edi, dword [ebx]
jmp 0x4023d7
push 2
pop eax
mov word [ebp - 0x14], ax
test edx, edx
je 0x4022aa
push edx
call dword [sym.imp.WS2_32.dll_inet_addr]
cmp eax, 0xffffffff
jne 0x4022a5
push 0xfffffffffffffffc
jmp 0x402415
mov dword [ebp - 0x10], eax
jmp 0x4022dc
test ecx, ecx
je 0x402413
push ecx
call dword [sym.imp.WS2_32.dll_gethostbyname]
mov ecx, eax
test ecx, ecx
jne 0x4022c6
push 0xfffffffffffffffb
jmp 0x402415
movsx eax, word [ecx + 0xa]
push eax
mov eax, dword [ecx + 0xc]
push dword [eax]
lea eax, [ebp - 0x10]
push eax
call fcn.00480c10
add esp, 0xc
push dword [ebp + 0x1c]
call dword [sym.imp.WS2_32.dll_htons]
mov edi, dword [ebp + 0xc]
mov word [ebp - 0x12], ax
lea eax, [ebp - 0x14]
push esi
push eax
push edi
call dword [sym.imp.WS2_32.dll_connect]
xor esi, esi
cmp eax, 0xffffffff
jne 0x4023d7
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
je 0x402329
cmp eax, 0x2735
je 0x402329
cmp eax, 0x2748
je 0x4023d7
push 0xfffffffffffffffa
jmp 0x402415
mov eax, dword [ebp + 0x10]
test eax, eax
jle 0x402279
mov dword [ebp - 0x334], eax
xor eax, eax
inc eax
mov dword [ebp - 0x330], esi
mov dword [ebp - 0x32c], eax
mov dword [ebp - 0x228], eax
lea eax, [ebp - 0x334]
push eax
lea eax, [ebp - 0x228]
mov dword [ebp - 0x328], edi
push eax
lea eax, [ebp - 0x32c]
mov dword [ebp - 0x224], edi
push eax
push esi
push esi
call dword [sym.imp.WS2_32.dll_select]
cmp eax, 0xffffffff
je 0x402322
lea eax, [ebp - 0x228]
push eax
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x4023c2
lea eax, [ebp - 0x33c]
mov dword [ebp - 0x340], esi
push eax
lea eax, [ebp - 0x340]
mov dword [ebp - 0x33c], 4
push eax
push 0x1007
push 0xffff
push edi
call dword [sym.imp.WS2_32.dll_getsockopt]
jmp 0x402322
lea eax, [ebp - 0x32c]
push eax
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402272
push esi
push esi
lea eax, [ebp - 0x344]
mov dword [ebp - 0x20], 1
push eax
push esi
push esi
push 0xc
lea eax, [ebp - 0x20]
mov dword [ebp - 0x1c], 0x186a0
push eax
push 0x98000004
push edi
mov dword [ebp - 0x18], 0x3e8
mov dword [ebp - 0x344], esi
call dword [sym.imp.WS2_32.dll_WSAIoctl]
xor eax, eax
jmp 0x402416
push 0xfffffffffffffffd
pop eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0047f259
mov esp, ebp
pop ebp
ret