Function at 0x513320
Capabilities:
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
push ebx
push edi
mov edi, eax
mov eax, dword [esi + 0xa0]
or eax, dword [esi + 0xa4]
mov dword [ebp - 0xc], 0
jne 0x513358
mov ecx, dword [esi + 0xa8]
or ecx, dword [esi + 0xac]
jne 0x513358
push 7
push esi
call fcn.00510e80
add esp, 8
mov ebx, 2
or dword [edi], ebx
cmp dword [esi + 0x14c], 0
jne 0x5135b3
cmp dword [esi + 0xc60], 0
jne 0x513393
mov edx, dword [esi + 0x8e8]
push edx
call dword [0x592304]
add esp, 4
mov dword [esi + 0xc60], eax
test eax, eax
je 0x5134f4
test byte [esi + 0x590], 4
mov eax, dword [esi + 0xc60]
mov dword [esi + 0x150], eax
jne 0x513492
mov eax, dword [esi + 0x154]
cmp dword [esi + 0x120], ebx
jne 0x51341e
cmp dword [eax + 0x1a0], ebx
jne 0x51341e
and dword [esi + 0x140], 0xfffffffd
lea ecx, [ebp - 0x20]
push ecx
mov dword [esi + 0x120], 1
call fcn.004f3990
mov edx, dword [eax]
mov dword [esi + 0x110], edx
mov ecx, dword [eax + 4]
mov dword [esi + 0x114], ecx
mov edx, dword [eax + 8]
mov dword [esi + 0x118], edx
mov eax, dword [eax + 0xc]
mov dword [esi + 0x11c], eax
and dword [edi], 0xfffffffd
mov eax, dword [esi + 0xa5c]
cdq
push 0
push edx
push eax
push esi
call fcn.004ea8f0
add esp, 0x14
pop edi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp + 8]
mov ecx, dword [edi + 0x2a8]
test dword [ecx + 0x40], 0x40003
je 0x51343f
xor edx, edx
cmp dword [eax + 0x1a0], 1
sete dl
mov dword [ebp - 0xc], edx
mov ecx, dword [esi + 0x8e8]
lea eax, [ebp - 4]
push eax
push ecx
push edi
call fcn.00512530
add esp, 0xc
test eax, eax
jne 0x513735
mov ebx, dword [ebp - 4]
mov dword [ebp - 0x10], ebx
test ebx, ebx
je 0x513495
jg 0x5134a4
and dword [esi + 0x140], 0xfffffffd
test byte [edi + 0x282], 1
je 0x513733
push edi
call fcn.00512910
add esp, 4
test eax, eax
je 0x513733
pop edi
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp + 8]
test byte [esi + 0x140], 0x20
jne 0x513733
jmp 0x513467
cmp dword [ebp - 0xc], 0
mov dword [esi + 0x14c], ebx
jne 0x51358d
test byte [esi + 0xa8c], 0x40
je 0x51358d
cmp dword [esi + 0xca8], 0
jne 0x5134ff
mov edx, dword [esi + 0x8e8]
add edx, edx
push edx
call dword [0x592304]
add esp, 4
mov dword [esi + 0xca8], eax
test eax, eax
jne 0x5134ff
push str.Failed_to_alloc_scratch_buffer_
push esi
call fcn.004ed150
add esp, 8
pop edi
mov eax, 0x1b
pop ebx
mov esp, ebp
pop ebp
ret
xor edi, edi
xor eax, eax
test ebx, ebx
jle 0x513571
jmp 0x513510
mov ecx, dword [esi + 0x150]
mov cl, byte [edi + ecx]
mov edx, dword [esi + 0xca8]
cmp cl, 0xa
jne 0x513568
mov byte [eax + edx], 0xd
mov ecx, dword [esi + 0xca8]
inc eax
mov byte [eax + ecx], 0xa
test byte [esi + 0xa8c], 0x40
jne 0x51356b
mov ecx, dword [esi + 0xf20]
mov edx, dword [esi + 0xf24]
mov ebx, ecx
and ebx, edx
cmp ebx, 0xffffffff
mov ebx, dword [ebp - 4]
je 0x51356b
add ecx, 1
adc edx, 0
mov dword [esi + 0xf20], ecx
mov dword [esi + 0xf24], edx
jmp 0x51356b
mov byte [eax + edx], cl
inc edi
inc eax
cmp edi, ebx
jl 0x513510
mov edi, dword [ebp + 8]
cmp eax, ebx
je 0x51358d
mov ecx, dword [esi + 0xca8]
mov dword [ebp - 0x10], eax
mov dword [esi + 0x150], ecx
mov dword [esi + 0x14c], eax
mov edx, dword [edi + 0x2a8]
test dword [edx + 0x40], 0x30000
je 0x5135b6
mov eax, dword [ebp - 0x10]
push eax
push edi
call fcn.004f9190
add esp, 8
test eax, eax
je 0x5135b6
pop edi
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp + 8]
mov edx, dword [esi + 0x14c]
mov eax, dword [esi + 0x150]
lea ecx, [ebp - 8]
push ecx
mov ecx, dword [edi + 0x2d0]
push edx
push eax
push ecx
push edi
call fcn.004ecce0
add esp, 0x14
test eax, eax
jne 0x513735
mov edi, dword [edi + 0x2d0]
push eax
push eax
lea edx, [ebp - 0xc]
push edx
push 4
lea eax, [ebp - 0x10]
push eax
push 0
push 0
push 0x4004747b
push edi
call dword [sym.imp.WS2_32.dll_WSAIoctl]
test eax, eax
jne 0x51361d
push 4
lea ecx, [ebp - 0x10]
push ecx
push 0x1001
push 0xffff
push edi
call dword [sym.imp.WS2_32.dll_setsockopt]
test dword [esi + 0xa8c], 0x4000000
je 0x51363f
mov edx, dword [ebp - 8]
mov eax, dword [esi + 0x150]
push edx
push eax
push 4
push esi
call fcn.004ecf90
add esp, 0x10
mov eax, dword [ebp - 8]
cdq
add dword [esi + 0xa8], eax
adc dword [esi + 0xac], edx
mov ecx, dword [esi + 0xac]
mov edx, dword [esi + 0xa8]
push ecx
push edx
push esi
call fcn.00511300
mov eax, dword [esi + 0x590]
add esp, 0xc
test al, 0x40
je 0x513677
test eax, 0x100
je 0x5136aa
mov ecx, dword [esi + 0xa8]
cmp ecx, dword [esi + 0xf20]
jne 0x5136aa
mov edx, dword [esi + 0xac]
cmp edx, dword [esi + 0xf24]
jne 0x5136aa
or eax, 4
push str.We_are_completely_uploaded_and_fine_n
push esi
mov dword [esi + 0x590], eax
call fcn.004ed020
add esp, 8
mov eax, dword [esi + 0x14c]
mov ecx, dword [ebp - 8]
cmp eax, ecx
je 0x5136cd
add dword [esi + 0x150], ecx
sub eax, ecx
pop edi
mov dword [esi + 0x14c], eax
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
cmp dword [esi + 0xc60], 0
jne 0x5136f4
mov eax, dword [esi + 0x8e8]
push eax
call dword [0x592304]
add esp, 4
mov dword [esi + 0xc60], eax
test eax, eax
je 0x5134f4
test byte [esi + 0x590], 4
mov ecx, dword [esi + 0xc60]
mov dword [esi + 0x150], ecx
mov dword [esi + 0x14c], 0
je 0x513733
mov eax, dword [ebp + 8]
and dword [esi + 0x140], 0xfffffffd
test byte [eax + 0x282], 1
je 0x513733
push eax
call fcn.00512910
add esp, 4
test eax, eax
jne 0x513735
xor eax, eax
pop edi
pop ebx
mov esp, ebp
pop ebp
ret