Function at 0x408040
Capabilities:
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4a70de
mov eax, dword fs:[0]
push eax
sub esp, 0x20
mov eax, dword [0x4d1088]
xor eax, ebp
mov dword [ebp - 0x14], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov esi, edx
xor ebx, ebx
mov dword [ebp - 4], 0
mov edi, fcn.0040f360
test esi, esi
je 0x4081be
call fcn.00477000
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x18], esi
mov eax, dword [eax + 0x18]
mov esi, dword [eax]
cmp esi, 0xffffffff
jne 0x4080aa
call fcn.00477000
mov ecx, 0x2719
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x20], ecx
jmp 0x4080f6
push 0
call dword [sym.imp.WS2_32.dll_WSASetLastError]
push 4
lea eax, [ebp - 0x18]
push eax
push 0x1001
push 0xffff
push esi
call dword [sym.imp.WS2_32.dll_setsockopt]
mov edi, eax
call fcn.00477000
mov esi, eax
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov dword [ebp - 0x1c], esi
mov ecx, eax
mov dword [ebp - 0x20], ecx
test edi, edi
jne 0x4080f1
call fcn.00477000
xor ecx, ecx
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x20], ecx
mov edi, fcn.0040f360
xor edx, edx
mov eax, edi
test ecx, ecx
cmove eax, edx
test eax, eax
je 0x40813e
mov eax, dword [0x4d1a00]
cmp eax, 0x4d1a00
je 0x408134
test byte [eax + 0x1c], 2
je 0x408134
cmp byte [eax + 0x19], 2
jb 0x408134
push ecx
push dword [eax + 0x14]
mov edx, 0x4be4d0
mov ecx, 0x73
push dword [eax + 0x10]
call fcn.00401a90
add esp, 0xc
mov ebx, 0xffffffe6
jmp 0x4082c5
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x28], 4
mov ecx, dword [eax + 0x18]
lea eax, [ebp - 0x20]
push eax
lea eax, [ebp - 0x28]
push eax
mov dl, byte [ecx + 4]
lea eax, [ebp - 0x18]
mov ecx, dword [ecx]
push eax
push 0x1001
push 0xffff
call fcn.0041a660
add esp, 0x14
cmp dword [ebp - 0x20], ebx
sete al
mov byte [ebp - 0x21], al
test al, al
je 0x4081be
push dword [ebp - 0x28]
push ecx
call fcn.00411680
mov al, byte [ebp - 0x21]
test al, al
je 0x4081be
mov eax, dword [0x4d1a00]
cmp eax, 0x4d1a00
je 0x4081be
test byte [eax + 0x1c], 2
je 0x4081be
cmp byte [eax + 0x19], 5
jb 0x4081be
push dword [ebp - 0x18]
mov edx, 0x4be4d0
mov ecx, 0x74
push dword [eax + 0x14]
push dword [eax + 0x10]
call fcn.00401a90
add esp, 0xc
mov esi, dword [ebp + 8]
test esi, esi
je 0x4082c5
xorps xmm0, xmm0
movq qword [ebp - 0x20], xmm0
mov dword [ebp - 0x20], ebx
call fcn.00477000
lea ecx, [ebp - 0x20]
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp + 0xc]
push ecx
lea ecx, [ebp - 0x18]
mov dword [ebp - 0x18], esi
push ecx
lea ecx, [ebp - 0x2c]
push ecx
mov ecx, dword [eax + 0x18]
call fcn.0040c950
mov ecx, dword [ebp - 0x20]
xor eax, eax
test ecx, ecx
cmove edi, eax
test edi, edi
je 0x408245
mov eax, dword [0x4d1a00]
cmp eax, 0x4d1a00
je 0x408134
test byte [eax + 0x1c], 2
je 0x408134
cmp byte [eax + 0x19], 2
jb 0x408134
push ecx
push dword [eax + 0x14]
mov edx, 0x4be4d0
mov ecx, 0x75
push dword [eax + 0x10]
call fcn.00401a90
mov ebx, 0xffffffe6
jmp 0x4082c2
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x28], 4
mov ecx, dword [eax + 0x18]
lea eax, [ebp - 0x20]
push eax
lea eax, [ebp - 0x28]
push eax
mov dl, byte [ecx + 4]
lea eax, [ebp - 0x18]
mov ecx, dword [ecx]
push eax
push 0x1002
push 0xffff
call fcn.0041a660
add esp, 0x14
cmp dword [ebp - 0x20], ebx
sete al
mov byte [ebp - 0x21], al
test al, al
je 0x4082c5
push dword [ebp - 0x28]
push ecx
call fcn.00411680
mov al, byte [ebp - 0x21]
test al, al
je 0x4082c5
mov eax, dword [0x4d1a00]
cmp eax, 0x4d1a00
je 0x4082c5
test byte [eax + 0x1c], 2
je 0x4082c5
cmp byte [eax + 0x19], 5
jb 0x4082c5
push dword [ebp - 0x18]
mov edx, 0x4be4d0
mov ecx, 0x76
push dword [eax + 0x14]
push dword [eax + 0x10]
call fcn.00401a90
add esp, 0xc
mov dword [ebp - 4], 1
mov esi, dword [ebp + 0x10]
test esi, esi
je 0x4082fe
or edi, 0xffffffff
lea ecx, [esi + 4]
mov eax, edi
lock xadd dword [ecx], eax
cmp eax, 1
jne 0x4082fe
mov eax, dword [esi]
mov ecx, esi
call dword [eax + 4]
lea edx, [esi + 8]
lock xadd dword [edx], edi
cmp edi, 1
jne 0x4082fe
mov edx, dword [esi]
mov ecx, esi
call dword [edx + 8]
mov eax, ebx
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.0047a4d6
mov esp, ebp
pop ebp
ret