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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x24
push ebx
push esi
mov esi, ecx
push edi
mov eax, dword [esi + 0x98]
or eax, dword [esi + 0x9c]
mov edi, edx
mov dword [esp + 0x1c], edi
mov dword [esp + 0xc], 0
jne 0x5219a4
mov eax, dword [esi + 0xa0]
or eax, dword [esi + 0xa4]
jne 0x5219a4
lea eax, [esp + 0x20]
push eax
call fcn.0051f970
mov ecx, dword [eax + 4]
mov edx, dword [eax]
mov dword [esp + 0x14], ecx
mov ecx, dword [eax + 8]
mov eax, dword [eax + 0xc]
mov dword [esp + 0x1c], eax
mov eax, dword [esi + 0xc24]
add esp, 4
mov dword [esp + 0x14], ecx
lea ebx, [esi + 0xb10]
test al, 2
jne 0x5219a4
or eax, 2
mov dword [esi + 0xc24], eax
test ebx, ebx
je 0x5219a4
mov eax, dword [esi + 0xb30]
sub esp, 0x10
mov ecx, esp
sub esp, 0x10
mov dword [ecx], eax
mov eax, dword [esi + 0xb34]
mov dword [ecx + 4], eax
mov eax, dword [esi + 0xb38]
mov dword [ecx + 8], eax
mov eax, dword [esi + 0xb3c]
mov dword [ecx + 0xc], eax
mov ecx, dword [esp + 0x30]
mov eax, esp
mov dword [eax], edx
mov dword [eax + 4], ecx
mov ecx, dword [esp + 0x34]
mov dword [eax + 8], ecx
mov ecx, dword [esp + 0x38]
mov dword [eax + 0xc], ecx
call fcn.0051f900
add esp, 0x20
test edx, edx
jg 0x52199f
jl 0x521998
cmp eax, 1
jae 0x52199f
mov eax, 1
xor edx, edx
add dword [ebx], eax
adc dword [ebx + 4], edx
mov ebx, dword [ebp + 8]
or dword [ebx], 2
cmp dword [esi + 0x144], 0
jne 0x521b9c
cmp dword [esi + 0xc50], 0
jne 0x5219dd
push dword [esi + 0x8e8]
call dword [0x593c18]
add esp, 4
mov dword [esi + 0xc50], eax
test eax, eax
je 0x521b0d
test byte [esi + 0x588], 4
mov eax, dword [esi + 0xc50]
mov dword [esi + 0x148], eax
jne 0x521d29
cmp dword [esi + 0x118], 2
mov ecx, dword [esi + 0x14c]
jne 0x521a70
cmp dword [ecx + 0x1a0], 2
jne 0x521a70
and dword [esi + 0x138], 0xfffffffd
lea eax, [esp + 0x20]
push eax
mov dword [esi + 0x118], 1
call fcn.0051f970
mov ecx, dword [eax]
and dword [ebx], 0xfffffffd
mov dword [esi + 0x108], ecx
mov ecx, dword [eax + 4]
mov dword [esi + 0x10c], ecx
mov ecx, dword [eax + 8]
mov dword [esi + 0x110], ecx
mov eax, dword [eax + 0xc]
mov dword [esi + 0x114], eax
mov eax, dword [esi + 0xa50]
cdq
add esp, 4
mov ecx, esi
push edx
push eax
xor edx, edx
call fcn.0050fc50
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [edi + 0x2c8]
test dword [eax + 0x40], 0x40003
je 0x521a8f
xor eax, eax
cmp dword [ecx + 0x1a0], 1
sete al
mov dword [esp + 0xc], eax
mov edx, dword [esi + 0x8e8]
lea eax, [esp + 0x10]
push eax
mov ecx, edi
call fcn.00522a40
add esp, 4
test eax, eax
jne 0x521dca
mov ebx, dword [esp + 0x10]
test ebx, ebx
je 0x521d29
jle 0x521d36
mov dword [esi + 0x144], ebx
cmp dword [esp + 0xc], eax
jne 0x521b9c
test byte [esi + 0xa80], 0x40
je 0x521b9c
cmp dword [esi + 0xc98], eax
jne 0x521b19
mov eax, dword [esi + 0x8e8]
add eax, eax
push eax
call dword [0x593c18]
add esp, 4
mov dword [esi + 0xc98], eax
test eax, eax
jne 0x521b19
push str.Failed_to_alloc_scratch_buffer_
push esi
call fcn.0051a7e0
add esp, 8
mov eax, 0x1b
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
xor edx, edx
xor ecx, ecx
test ebx, ebx
jle 0x521b86
mov eax, dword [esi + 0x148]
mov bl, byte [edx + eax]
mov eax, dword [esi + 0xc98]
cmp bl, 0xa
jne 0x521b75
mov byte [ecx + eax], 0xd
mov eax, dword [esi + 0xc98]
inc ecx
mov byte [ecx + eax], bl
test byte [esi + 0xa80], 0x40
jne 0x521b78
mov edi, dword [esi + 0xf38]
mov ebx, dword [esi + 0xf3c]
mov eax, edi
and eax, ebx
cmp eax, 0xffffffff
je 0x521b78
add edi, 1
adc ebx, 0
mov dword [esi + 0xf38], edi
mov dword [esi + 0xf3c], ebx
jmp 0x521b78
mov byte [ecx + eax], bl
mov ebx, dword [esp + 0x10]
inc edx
inc ecx
cmp edx, ebx
jl 0x521b21
mov edi, dword [esp + 0x1c]
cmp ecx, ebx
je 0x521b9c
mov eax, dword [esi + 0xc98]
mov dword [esi + 0x148], eax
mov dword [esi + 0x144], ecx
mov eax, dword [edi + 0x2f0]
xor ecx, ecx
cmp eax, dword [edi + 0x1bc]
lea eax, [esp + 0x10]
push eax
push dword [esi + 0x144]
sete cl
push dword [esi + 0x148]
mov dword [esp + 0x1c], 0
push ecx
mov eax, dword [edi + ecx*4 + 0x1d8]
push edi
call eax
mov ebx, eax
add esp, 0x14
test ebx, ebx
jns 0x521bf1
mov eax, dword [esp + 0x10]
test eax, eax
je 0x521d5c
cmp eax, 0x51
jne 0x521dca
xor ebx, ebx
mov eax, dword [edi + 0x2f0]
push 0
push 0
lea ecx, [esp + 0x1c]
push ecx
push 4
lea ecx, [esp + 0x2c]
push ecx
push 0
push 0
push 0x4004747b
push eax
mov dword [esp + 0x3c], eax
call dword [sym.imp.WS2_32.dll_WSAIoctl]
test eax, eax
jne 0x521c3a
push 4
lea eax, [esp + 0x20]
push eax
push 0x1001
push 0xffff
push dword [esp + 0x28]
call dword [sym.imp.WS2_32.dll_setsockopt]
test dword [esi + 0xa80], 0x2000000
je 0x521c9b
cmp dword [esi + 0x600], 0
mov ecx, dword [esi + 0x148]
je 0x521c9b
mov eax, dword [esi + 0x7c]
test eax, eax
jne 0x521c63
mov eax, dword [esi + 0x78]
test eax, eax
je 0x521c6d
mov dword [eax + 0xe0], 1
push dword [esi + 0x594]
mov eax, dword [esi + 0x600]
push ebx
push ecx
push 4
push esi
call eax
mov eax, dword [esi + 0x7c]
add esp, 0x14
test eax, eax
jne 0x521c91
mov eax, dword [esi + 0x78]
test eax, eax
je 0x521c9b
mov dword [eax + 0xe0], 0
mov eax, ebx
cdq
add dword [esi + 0xa0], eax
mov eax, dword [esi + 0xa0]
adc dword [esi + 0xa4], edx
mov dword [esi + 0xac0], eax
mov eax, dword [esi + 0xa4]
mov dword [esi + 0xac4], eax
mov ecx, dword [esi + 0x588]
test cl, 0x40
je 0x521cd5
test ecx, 0x100
je 0x521d08
mov eax, dword [esi + 0xa0]
cmp eax, dword [esi + 0xf38]
jne 0x521d08
mov eax, dword [esi + 0xa4]
cmp eax, dword [esi + 0xf3c]
jne 0x521d08
or ecx, 4
push str.We_are_completely_uploaded_and_fine_n
push esi
mov dword [esi + 0x588], ecx
call fcn.0051a600
add esp, 8
mov eax, dword [esi + 0x144]
cmp eax, ebx
je 0x521d68
add dword [esi + 0x148], ebx
sub eax, ebx
mov dword [esi + 0x144], eax
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
test byte [esi + 0x138], 0x20
jne 0x521dc8
and dword [esi + 0x138], 0xfffffffd
test byte [edi + 0x2a6], 1
je 0x521dc8
mov ecx, edi
call fcn.005228b0
test eax, eax
je 0x521dc8
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, 0x37
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp dword [esi + 0xc50], 0
jne 0x521d8e
push dword [esi + 0x8e8]
call dword [0x593c18]
add esp, 4
mov dword [esi + 0xc50], eax
test eax, eax
je 0x521b0d
test byte [esi + 0x588], 4
mov eax, dword [esi + 0xc50]
mov dword [esi + 0x148], eax
mov dword [esi + 0x144], 0
je 0x521dc8
and dword [esi + 0x138], 0xfffffffd
test byte [edi + 0x2a6], 1
je 0x521dc8
mov ecx, edi
call fcn.005228b0
test eax, eax
jne 0x521dca
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret