Function at 0x51f040
Capabilities:
Connect socket
Set socket configuration

Disassembly:
sub esp, 0x50
mov eax, dword [0x5e1040]
xor eax, esp
mov dword [esp + 0x4c], eax
mov ecx, dword [esp + 0x5c]
mov edx, 2
push ebx
mov ebx, dword [esp + 0x58]
push ebp
mov ebp, dword [esp + 0x60]
push esi
mov esi, ecx
neg esi
mov eax, dword [ebp + 4]
sbb esi, esi
add esi, 2
mov dword [esp + 0xc], esi
push edi
lea edi, [edx + 0x15]
sub eax, 2
je 0x51f0e6
sub eax, 0x15
je 0x51f096
pop edi
pop esi
pop ebp
lea eax, [edx + 7]
pop ebx
mov ecx, dword [esp + 0x4c]
xor ecx, esp
call fcn.004224b5
add esp, 0x50
ret
mov dword [esp + 0x14], 0x1c
xorps xmm0, xmm0
movlpd qword [esp + 0x28], xmm0
movlpd qword [esp + 0x30], xmm0
mov dword [esp + 0x38], 0
mov word [esp + 0x24], di
test ecx, ecx
je 0x51f0c4
movzx eax, word [ebp + 0x1a]
jmp 0x51f0c8
movzx eax, word [ebp + 0x18]
push eax
call dword [sym.imp.WS2_32.dll_htons]
movups xmm0, xmmword [ebp + 8]
mov word [esp + 0x26], ax
mov eax, dword [ebp + 0x5c]
movups xmmword [esp + 0x2c], xmm0
mov dword [esp + 0x3c], eax
jmp 0x51f11d
mov dword [esp + 0x14], 0x10
xorps xmm0, xmm0
movlpd qword [esp + 0x2c], xmm0
mov word [esp + 0x24], dx
test ecx, ecx
je 0x51f106
movzx eax, word [ebp + 0x1a]
jmp 0x51f10a
movzx eax, word [ebp + 0x18]
push eax
call dword [sym.imp.WS2_32.dll_htons]
mov word [esp + 0x26], ax
mov eax, dword [ebp + 8]
mov dword [esp + 0x28], eax
mov eax, dword [ebx + 0xb4]
mov ecx, dword [ebp + 4]
test eax, eax
je 0x51f141
mov eax, dword [eax]
test eax, eax
je 0x51f141
push dword [ebx + 0xb8]
push 0
push esi
push ecx
call eax
add esp, 0x10
jmp 0x51f14b
push 0
push esi
push ecx
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, 0xffffffff
je 0x51f348
mov edi, dword [ebp + 0x74]
mov eax, dword [edi + 0xb4]
test eax, eax
je 0x51f16c
cmp dword [eax], 0
jne 0x51f256
lea eax, [esp + 0x1c]
mov dword [esp + 0x1c], 1
push eax
push 0x8004667e
push esi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp dword [edi + 0x1c], 0
lea eax, [edi + 0x1c]
jle 0x51f1ab
push 4
push eax
push 0x1001
push 0xffff
push esi
call dword [sym.imp.WS2_32.dll_setsockopt]
cmp eax, 0xffffffff
je 0x51f32b
cmp dword [edi + 0x20], 0
lea eax, [edi + 0x20]
jle 0x51f1d1
push 4
push eax
push 0x1002
push 0xffff
push esi
call dword [sym.imp.WS2_32.dll_setsockopt]
cmp eax, 0xffffffff
je 0x51f32b
mov eax, dword [ebp + 4]
cmp eax, 2
jne 0x51f203
cmp dword [edi + 0x68], 0
je 0x51f236
xorps xmm0, xmm0
movups xmmword [esp + 0x40], xmm0
mov word [esp + 0x40], ax
push dword [edi + 0x68]
call dword [sym.imp.WS2_32.dll_htonl]
mov dword [esp + 0x44], eax
mov eax, 0x10
jmp 0x51f316
cmp eax, 0x17
jne 0x51f236
cmp dword [ebp + 0x5c], 0
jne 0x51f236
lea eax, [edi + 0x6c]
mov edx, 0x59b214
mov dword [esp + 0x18], eax
mov ecx, eax
mov edi, 0xc
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x51f2e5
add ecx, 4
add edx, 4
sub edi, 4
jae 0x51f221
cmp dword [ebp + 4], 0x17
jne 0x51f256
push 4
lea eax, [esp + 0x1c]
mov dword [esp + 0x1c], 0
push eax
push 0x1b
push 0x29
push esi
call dword [sym.imp.WS2_32.dll_setsockopt]
cmp dword [esp + 0x6c], 0
je 0x51f28f
mov eax, dword [ebx + 0xb4]
mov dword [esp + 0x20], 1
test eax, eax
je 0x51f274
cmp dword [eax], 0
jne 0x51f28f
push 4
lea eax, [esp + 0x24]
push eax
push 1
push 6
push esi
call dword [sym.imp.WS2_32.dll_setsockopt]
cmp eax, 0xffffffff
je 0x51f3ad
mov eax, dword [ebx + 0xac]
mov edi, dword [esp + 0x10]
test eax, eax
je 0x51f2b2
push dword [ebx + 0xb0]
push edi
push esi
call eax
add esp, 0xc
test eax, eax
js 0x51f3ad
mov eax, dword [ebx + 0xb4]
test eax, eax
je 0x51f369
mov eax, dword [eax + 8]
test eax, eax
je 0x51f369
push dword [ebx + 0xb8]
lea ecx, [esp + 0x28]
push dword [esp + 0x18]
push ecx
push esi
call eax
add esp, 0x10
jmp 0x51f379
xorps xmm0, xmm0
mov dword [esp + 0x58], 0
movups xmmword [esp + 0x40], xmm0
mov eax, 0x17
movq qword [esp + 0x50], xmm0
mov word [esp + 0x40], ax
mov eax, dword [esp + 0x18]
movups xmm0, xmmword [eax]
mov eax, 0x1c
movups xmmword [esp + 0x48], xmm0
push eax
lea eax, [esp + 0x44]
push eax
push esi
call dword [sym.imp.WS2_32.dll_bind]
test eax, eax
jns 0x51f236
mov eax, dword [ebx + 0xb4]
test eax, eax
je 0x51f360
mov eax, dword [eax + 4]
test eax, eax
je 0x51f360
push dword [ebx + 0xb8]
push esi
call eax
add esp, 8
pop edi
pop esi
pop ebp
mov eax, 0xb
pop ebx
mov ecx, dword [esp + 0x4c]
xor ecx, esp
call fcn.004224b5
add esp, 0x50
ret
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x51f348
push dword [esp + 0x14]
lea eax, [esp + 0x28]
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x51f392
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2734
je 0x51f392
cmp eax, 0x2733
jne 0x51f3ad
mov eax, dword [ebx + 0xa4]
test eax, eax
je 0x51f3b6
push dword [ebx + 0xa8]
push edi
push esi
call eax
add esp, 0xc
test eax, eax
jns 0x51f3b6
push esi
push ebx
call fcn.0051efc0
jmp 0x51f345
push 0x14
call dword [0x5e15e8]
mov edi, eax
add esp, 4
test edi, edi
jne 0x51f3e7
push esi
push ebx
call fcn.0051efc0
add esp, 8
lea eax, [edi + 0xf]
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x4c]
xor ecx, esp
call fcn.004224b5
add esp, 0x50
ret
mov dword [edi + 8], 0
mov dword [edi + 0xc], 0
mov dword [edi + 0x10], 0
push 0
mov dword [edi + 4], esi
mov dword [edi], ebp
call fcn.00513980
mov ecx, dword [esp + 0x70]
add esp, 4
mov dword [edi + 0x10], eax
mov dword [edi + 8], ecx
test eax, eax
jne 0x51f442
push esi
push ebx
call fcn.0051efc0
push edi
call dword [0x5e15f0]
add esp, 0xc
mov eax, 0xf
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x4c]
xor ecx, esp
call fcn.004224b5
add esp, 0x50
ret
mov eax, dword [ebp + 0x64]
push edi
push eax
test ecx, ecx
je 0x51f452
call fcn.00513ab0
jmp 0x51f457
call fcn.00513a50
add esp, 8
mov dword [esp + 0x10], eax
test eax, eax
jne 0x51f493
push esi
push ebx
call fcn.0051efc0
push dword [edi + 0x10]
call fcn.005139a0
push edi
call dword [0x5e15f0]
add esp, 0x10
mov eax, 0xf
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x4c]
xor ecx, esp
call fcn.004224b5
add esp, 0x50
ret
push eax
push esi
push dword [ebx + 0x98]
call fcn.00514430
add esp, 0xc
test eax, eax
jne 0x51f4e1
push esi
push ebx
call fcn.0051efc0
push dword [edi + 0x10]
call fcn.005139a0
push dword [esp + 0x1c]
call fcn.00513b40
push edi
call dword [0x5e15f0]
add esp, 0x14
mov eax, 0xf
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x4c]
xor ecx, esp
call fcn.004224b5
add esp, 0x50
ret
mov eax, dword [ebx + 0x9c]
test eax, eax
je 0x51f4fb
push 0
push 1
push esi
push dword [ebx + 0xa0]
call eax
add esp, 0x10
cmp dword [esp + 0x6c], 0
je 0x51f505
mov dword [ebp + 0x68], edi
mov ecx, dword [esp + 0x5c]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.004224b5
add esp, 0x50
ret