Function at 0x50af20
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x10
mov eax, dword [esp + 0x14]
push ebx
xor ebx, ebx
push ebp
push esi
cmp eax, ebx
push edi
mov esi, ecx
mov dword [esp + 0x14], ebx
mov dword [esp + 0x10], ebx
je 0x50b25a
mov eax, dword [esp + 0x28]
cmp eax, ebx
je 0x50b25a
mov edi, dword [esp + 0x2c]
cmp edi, 1
jl 0x50b25a
mov ecx, dword [esi + 4]
or ebp, 0xffffffff
cmp ecx, ebp
je 0x50b25a
mov dword [eax], ebx
lea eax, [esp + 0x18]
push 4
push eax
mov ecx, esi
call fcn.0050aca0
cmp eax, 1
jne 0x50afea
xor eax, eax
mov ecx, dword [esi + 0x1b0]
mov edx, ecx
and edx, 0xf
mov dl, byte [edx + esi + 0x18c]
add dl, byte [esi + 0x1ac]
xor byte [esp + eax + 0x18], dl
inc ecx
movsx edx, byte [esp + eax + 0x18]
inc eax
mov dword [esi + 0x1ac], edx
cmp eax, 4
mov dword [esi + 0x1b0], ecx
jl 0x50af7d
mov eax, dword [esp + 0x18]
cmp eax, ebx
jl 0x50b22d
cmp eax, edi
jg 0x50b22d
cmp eax, ebx
jne 0x50b016
mov eax, dword [esp + 0x10]
cmp eax, ebx
je 0x50afdb
push eax
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x10
ret 0xc
mov eax, dword [esi + 4]
cmp eax, ebp
je 0x50b005
push 2
push eax
call sub.WS2_32.dll_shutdown
mov eax, dword [esi + 4]
push eax
call sub.WS2_32.dll_closesocket
mov dword [esi + 4], ebp
mov eax, dword [esp + 0x10]
cmp eax, ebx
je 0x50b25a
jmp 0x50b250
lea ecx, [esp + 0x1c]
push 4
push ecx
mov ecx, esi
call fcn.0050aca0
cmp eax, 1
jne 0x50b0c8
xor eax, eax
mov ecx, dword [esi + 0x1b0]
mov edx, ecx
and edx, 0xf
mov dl, byte [edx + esi + 0x18c]
add dl, byte [esi + 0x1ac]
xor byte [esp + eax + 0x1c], dl
inc ecx
movsx edx, byte [esp + eax + 0x1c]
inc eax
mov dword [esi + 0x1ac], edx
cmp eax, 4
mov dword [esi + 0x1b0], ecx
jl 0x50b02f
mov eax, dword [esp + 0x1c]
cmp eax, 1
jl 0x50b211
lea ecx, [edi + edi]
cmp eax, ecx
jg 0x50b211
mov edx, eax
add edx, 0x10
push edx
call fcn.004c2e90
mov edi, eax
add esp, 4
cmp edi, ebx
jne 0x50b0f4
mov eax, dword [esi + 4]
cmp eax, ebp
je 0x50b0aa
push 2
push eax
call sub.WS2_32.dll_shutdown
mov eax, dword [esi + 4]
push eax
call sub.WS2_32.dll_closesocket
mov dword [esi + 4], ebp
mov ecx, dword [esp + 0x1c]
push ecx
push str.ReadCompressed:_not_enough_memory___d_bytes_
push 1
push 0x596558
call fcn.004aa400
add esp, 0x10
jmp 0x50b005
mov eax, dword [esi + 4]
cmp eax, ebp
je 0x50b0e3
push 2
push eax
call sub.WS2_32.dll_shutdown
mov eax, dword [esi + 4]
push eax
call sub.WS2_32.dll_closesocket
mov dword [esi + 4], ebp
mov eax, dword [esp + 0x10]
cmp eax, ebx
je 0x50b25a
jmp 0x50b250
mov ebx, dword [esp + 0x1c]
mov ecx, esi
mov edx, ebx
push edx
push edi
call fcn.0050aca0
cmp eax, 1
jne 0x50b1a9
xor eax, eax
test ebx, ebx
jle 0x50b14d
mov ecx, dword [esi + 0x1b0]
and ecx, 0xf
mov dl, byte [ecx + esi + 0x18c]
mov cl, byte [esi + 0x1ac]
add dl, cl
mov cl, byte [eax + edi]
xor cl, dl
mov byte [eax + edi], cl
mov ebp, dword [esi + 0x1b0]
movsx ecx, cl
inc ebp
inc eax
cmp eax, ebx
mov dword [esi + 0x1ac], ecx
mov dword [esi + 0x1b0], ebp
jl 0x50b112
mov edx, dword [esp + 0x2c]
mov ecx, dword [esp + 0x24]
lea eax, [esp + 0x14]
mov dword [esp + 0x14], edx
mov edx, dword [esp + 0x1c]
push eax
push ecx
push edx
push edi
lea ecx, [esp + 0x20]
call fcn.0042c520
test eax, eax
je 0x50b1ce
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x14]
cmp eax, ecx
jne 0x50b1ce
push edi
call fcn.004c2eb0
mov edx, dword [esp + 0x2c]
mov ecx, dword [esp + 0x1c]
add esp, 4
mov dword [edx], ecx
lea ecx, [esp + 0x10]
call fcn.0050b270
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x10
ret 0xc
push edi
call fcn.004c2eb0
add esp, 4
mov ecx, esi
call fcn.00508240
lea ecx, [esp + 0x10]
call fcn.0050b270
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret 0xc
mov ecx, esi
call fcn.00508240
push edi
call fcn.004c2eb0
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x20]
add esp, 4
push eax
push ecx
push str.ReadCompressed:_decoding_failed___d_____d_bytes_
push 1
push 0x596558
call fcn.004aa400
add esp, 0x14
lea ecx, [esp + 0x10]
call fcn.0050b270
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret 0xc
mov eax, dword [esi + 4]
cmp eax, ebp
je 0x50b005
push 2
push eax
call sub.WS2_32.dll_shutdown
mov edx, dword [esi + 4]
push edx
jmp 0x50affd
mov eax, dword [esi + 4]
cmp eax, ebp
je 0x50b248
push 2
push eax
call sub.WS2_32.dll_shutdown
mov eax, dword [esi + 4]
push eax
call sub.WS2_32.dll_closesocket
mov dword [esi + 4], ebp
mov eax, dword [esp + 0x10]
cmp eax, ebx
je 0x50b25a
push eax
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret 0xc