Function at 0x4040d0
Capabilities:
Connect socket

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xa0
mov edx, dword [ebx]
push esi
mov esi, eax
mov eax, dword [ebp + 0xc]
mov dword [eax], 0xffffffff
mov eax, dword [ebx + 0x6c]
cmp eax, 2
mov ecx, dword [esi + 4]
push edi
mov dword [esp + 0x14], 0
mov dword [esp + 8], edx
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], eax
jne 0x404114
mov dword [esp + 0x20], 0x11
jmp 0x40411b
mov eax, dword [esi + 0xc]
mov dword [esp + 0x20], eax
mov ecx, dword [esi + 0x10]
cmp ecx, 0x80
mov dword [esp + 0x24], ecx
jbe 0x404133
mov ecx, 0x80
mov dword [esp + 0x24], ecx
mov esi, dword [esi + 0x18]
mov eax, ecx
shr ecx, 2
lea edi, [esp + 0x28]
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp + 0x10]
mov dword [ecx], 0
mov eax, dword [edx + 0x16c]
test eax, eax
je 0x404176
mov edx, dword [edx + 0x170]
lea ecx, [esp + 0x18]
push ecx
push 0
push edx
call eax
mov edi, eax
add esp, 0xc
mov dword [esp + 0xc], edi
jmp 0x404191
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x18]
push eax
push ecx
push edx
call dword [sym.imp.WS2_32.dll_socket]
mov dword [esp + 0xc], eax
mov edi, eax
cmp edi, 0xffffffff
je 0x404479
movzx eax, word [esp + 0x28]
sub eax, 2
lea esi, [ebx + 0x96]
jne 0x404253
push 0x2e
push esi
lea eax, [esp + 0x34]
push eax
push 2
call fcn.004046c0
add esp, 0x10
test eax, eax
je 0x404253
mov ecx, dword [esp + 0x2a]
push ecx
call dword [sym.imp.WS2_32.dll_ntohs]
movzx edx, ax
lea eax, [ebx + 0x38]
mov dword [ebx + 0xc4], edx
mov edi, eax
mov ecx, 0xb
rep movsd dword es:[edi], dword [esi]
push eax
movsw word es:[edi], word [esi]
mov edi, dword [esp + 0xc]
push str.__Trying__s...
push edi
call fcn.004033d0
push ebx
call fcn.00403df0
mov eax, dword [edi + 0x2fc]
mov esi, dword [esp + 0x1c]
add esp, 0x10
test eax, eax
je 0x40421e
mov edx, esi
mov edi, ebx
call fcn.00404000
mov edi, dword [esp + 8]
push esi
call fcn.00404060
mov eax, dword [edi + 0x164]
add esp, 4
test eax, eax
je 0x40429a
mov ecx, dword [edi + 0x168]
push 0
push esi
push ecx
call eax
add esp, 0xc
cmp eax, 2
mov dword [esp + 0x10], eax
jne 0x404292
mov dword [esp + 0x14], 1
jmp 0x40429a
mov byte [esi], 0
mov dword [ebx + 0xc4], 0
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
push esi
push ebx
call fcn.00418c70
push eax
mov eax, dword [esp + 0x14]
push esi
push str.sa_addr_inet_ntop___failed_with_errno__d:__s
push eax
call fcn.00403490
add esp, 0x18
push edi
call dword [sym.imp.WS2_32.dll_closesocket]
xor eax, eax
pop edi
pop esi
mov esp, ebp
pop ebp
ret
test eax, eax
jne 0x4043eb
mov edx, dword [esp + 0x18]
push edx
push esi
push ebx
call fcn.00403a90
mov edi, eax
add esp, 0xc
test edi, edi
je 0x4042be
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, edi
pop edi
pop esi
mov esp, ebp
pop ebp
ret
push 1
push esi
call fcn.00419470
mov eax, dword [esp + 0x1c]
add esp, 8
test eax, eax
jne 0x40437c
cmp dword [ebx + 0x6c], 1
jne 0x40437c
mov eax, dword [esp + 0x24]
push eax
lea ecx, [esp + 0x2c]
push ecx
push esi
call dword [sym.imp.WS2_32.dll_connect]
mov edi, eax
call fcn.004168e0
mov dword [ebx + 0x1f4], eax
cmp dword [ebx + 0x1fc], 1
mov dword [ebx + 0x1f8], edx
jle 0x404320
mov edx, dword [ebx + 0x200]
mov eax, dword [esp + 8]
push edx
push eax
call fcn.00415af0
add esp, 8
cmp edi, 0xffffffff
jne 0x4043fd
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0xb
mov dword [esp + 0x10], eax
je 0x4043d6
cmp eax, 0x2732
jle 0x40434e
cmp eax, 0x2734
jle 0x4043d6
push eax
push ebx
call fcn.00418c70
mov ecx, dword [esp + 0x10]
push eax
lea eax, [ebx + 0x38]
push eax
push str.Failed_to_connect_to__s:__s
push ecx
call fcn.00403490
mov edx, dword [esp + 0x28]
mov eax, dword [esp + 0x20]
add esp, 0x18
mov dword [eax + 0x8554], edx
jmp 0x404386
mov eax, dword [esp + 0x14]
xor edi, edi
test eax, eax
jne 0x4043a7
push esi
lea esi, [esp + 0x14]
call fcn.00403d80
add esp, 4
test edi, edi
jne 0x404420
test eax, eax
je 0x40444a
mov esi, dword [esp + 0xc]
mov ecx, dword [esp + 8]
mov eax, dword [ebp + 0x10]
push str.connected_n
push ecx
mov dword [eax], 1
call fcn.004033d0
push esi
push ebx
call fcn.00403ea0
mov edx, dword [ebp + 0xc]
add esp, 0x10
mov dword [edx], esi
xor eax, eax
pop edi
pop esi
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 8]
push ebx
mov edi, esi
call fcn.00403a20
mov edi, eax
add esp, 4
cmp edi, 3
jne 0x4043fd
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
mov eax, 0x2a
pop edi
pop esi
mov esp, ebp
pop ebp
ret
cmp edi, 1
jne 0x404386
mov ecx, dword [esp + 8]
cmp dword [ecx + 0x508], 2
jne 0x404386
mov edx, dword [ebp + 0xc]
mov dword [edx], esi
xor eax, eax
pop edi
pop esi
mov esp, ebp
pop ebp
ret
cmp edi, 1
jne 0x40444a
mov eax, dword [esp + 8]
push str.Timeout_n
push eax
call fcn.004033d0
mov ecx, dword [esp + 0x14]
add esp, 8
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
xor eax, eax
pop edi
pop esi
mov esp, ebp
pop ebp
ret
mov eax, dword [esp + 0x10]
mov esi, dword [esp + 8]
push eax
push ebx
mov dword [esi + 0x8554], eax
call fcn.00418c70
push eax
push 0x43269c
push esi
call fcn.004033d0
mov ecx, dword [esp + 0x20]
add esp, 0x14
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
pop edi
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret