Function at 0x515820
Capabilities:
Connect socket
Resolve function by parsing pe exports
Set socket configuration

Disassembly:
sub esp, 0x168
mov eax, dword [0x592830]
xor eax, esp
mov dword [esp + 0x164], eax
mov eax, dword [esp + 0x16c]
push ebx
push ebp
mov ebp, ecx
push esi
mov ebx, dword [ebp]
mov dword [esp + 0x18], eax
mov dword [eax], 0xffffffff
push edi
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x34]
push eax
mov dword [esp + 0x20], 0
call fcn.00515700
mov edi, eax
add esp, 8
test edi, edi
jne 0x515b38
movzx eax, word [esp + 0x40]
sub eax, 2
jne 0x515ae9
push 0x2e
lea edx, [esp + 0xc4]
lea ecx, [esp + 0x48]
call fcn.0052e310
add esp, 4
test eax, eax
je 0x515ae9
push dword [esp + 0x42]
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
push eax
lea eax, [esp + 0xc4]
push eax
push str.__Trying__s:_ld..._n
push ebx
call fcn.0051a600
mov esi, dword [esp + 0x24]
add esp, 0x10
cmp dword [esp + 0x30], 2
jne 0x5158f2
cmp dword [esp + 0x34], 1
jne 0x5158f2
test dword [ebx + 0xa80], 0x40000000
mov dword [esp + 0x14], 1
je 0x5158fa
mov edx, esi
mov ecx, ebp
call fcn.00515c00
jmp 0x5158fa
mov dword [esp + 0x14], 0
mov ecx, esi
call fcn.00515b60
cmp dword [esp + 0x14], 0
je 0x51591a
test byte [ebx + 0xa84], 0x40
je 0x51591a
mov edx, esi
mov ecx, ebx
call fcn.005161a0
cmp dword [ebx + 0x608], 0
je 0x515976
mov eax, dword [ebx + 0x7c]
test eax, eax
jne 0x515931
mov eax, dword [ebx + 0x78]
test eax, eax
je 0x51593b
mov dword [eax + 0xe0], 1
mov eax, dword [ebx + 0x608]
push 0
push esi
push dword [ebx + 0x60c]
call eax
mov ecx, eax
mov eax, dword [ebx + 0x7c]
add esp, 0xc
test eax, eax
jne 0x51595f
mov eax, dword [ebx + 0x78]
test eax, eax
je 0x515969
mov dword [eax + 0xe0], 0
cmp ecx, 2
jne 0x5159ac
mov dword [esp + 0x18], 1
cmp dword [esp + 0x30], 2
jne 0x5159c3
push ecx
push 2
mov edx, esi
mov ecx, ebp
call fcn.00515e30
mov edi, eax
add esp, 8
test edi, edi
je 0x5159c3
mov edx, esi
mov ecx, ebp
call fcn.00516300
cmp edi, 1
jne 0x515add
lea eax, [edi + 6]
jmp 0x515b3a
test ecx, ecx
je 0x515976
mov edx, esi
mov ecx, ebp
call fcn.00516300
mov eax, 0x2a
jmp 0x515b3a
lea eax, [esp + 0x14]
push eax
push 0x8004667e
push esi
mov dword [esp + 0x20], 1
call dword [sym.imp.WS2_32.dll_ioctlsocket]
lea eax, [esp + 0x20]
push eax
call fcn.0051f970
mov ecx, dword [eax]
mov dword [ebp + 0x2a8], ecx
mov ecx, dword [eax + 4]
mov dword [ebp + 0x2ac], ecx
mov ecx, dword [eax + 8]
mov dword [ebp + 0x2b0], ecx
mov eax, dword [eax + 0xc]
add esp, 4
cmp dword [ebp + 0x2b8], 1
mov dword [ebp + 0x2b4], eax
jle 0x515a30
push dword [ebp + 0x2c4]
mov edx, 3
push dword [ebp + 0x2c0]
mov ecx, ebx
call fcn.0050fc50
add esp, 8
cmp dword [esp + 0x18], 0
jne 0x515ae1
cmp dword [ebp + 0x90], 1
jne 0x515ae1
test byte [ebp + 0x2a7], 1
jne 0x515a77
push dword [esp + 0x3c]
lea eax, [esp + 0x44]
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
je 0x515a77
test edi, edi
jne 0x515add
mov eax, dword [esp + 0x1c]
mov dword [eax], esi
mov eax, edi
jmp 0x515b3a
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov edi, eax
cmp edi, 0xb
je 0x515ad5
cmp edi, 0x2732
jle 0x515a94
cmp edi, 0x2734
jle 0x515ad5
push ecx
lea edx, [esp + 0xf4]
mov ecx, edi
call fcn.0052ebf0
add esp, 4
push eax
lea eax, [esp + 0xc4]
push eax
push str.Immediate_connect_fail_for__s:__s_n
push ebx
call fcn.0051a600
add esp, 0x10
mov edx, esi
mov ecx, ebp
mov dword [ebx + 0xc9c], edi
call fcn.00516300
mov edi, 7
mov eax, edi
jmp 0x515b3a
mov eax, dword [esp + 0x1c]
xor edi, edi
mov dword [eax], esi
mov eax, edi
jmp 0x515b3a
mov eax, dword [esp + 0x1c]
mov dword [eax], esi
jmp 0x515b38
mov byte [esp + 0xc0], 0
call fcn.004eeb81
mov dword [eax], 0x273f
call fcn.004eeb81
mov esi, eax
call fcn.004eeb81
push ecx
mov ecx, dword [esi]
lea edx, [esp + 0xf4]
mov edi, eax
call fcn.0052ebf0
add esp, 4
push eax
push dword [edi]
push str.sa_addr_inet_ntop___failed_with_errno__d:__s
push ebx
call fcn.0051a7e0
mov edx, dword [esp + 0x24]
add esp, 0x10
mov ecx, ebp
call fcn.00516300
xor eax, eax
mov ecx, dword [esp + 0x174]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.004ebb9e
add esp, 0x168
ret