Function at 0x508540
Capabilities:
Encode data using xor

Disassembly:
mov eax, 0x1f8
call fcn.004740c0
mov eax, dword [0x5db008]
xor eax, esp
mov dword [esp + 0x1f4], eax
mov eax, dword [esp + 0x204]
push ebp
mov ebp, dword [esp + 0x21c]
push esi
mov esi, dword [esp + 0x204]
push edi
mov edi, dword [esp + 0x21c]
push edi
mov dword [esp + 0x20], eax
mov dword [esp + 0x1c], 1
call fcn.004d17f0
add esp, 4
mov dword [esp + 0x14], eax
test eax, eax
js 0x5085f2
lea eax, [esp + 0xf0]
push eax
call fcn.00519c30
add esp, 4
test esi, esi
jne 0x5085ac
xor ecx, ecx
jmp 0x5085c9
mov ecx, dword [esp + 0x20c]
cmp ecx, 0xffffffff
jne 0x5085c9
mov ecx, esi
lea edx, [ecx + 1]
nop dword [eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x5085c0
sub ecx, edx
push 0
push edi
push ecx
lea eax, [esp + 0xfc]
push esi
push eax
call fcn.00519d40
add esp, 0x14
test eax, eax
jne 0x50860c
lea eax, [esp + 0xf0]
push eax
call fcn.00519b90
add esp, 4
pop edi
pop esi
xor eax, eax
pop ebp
mov ecx, dword [esp + 0x1f4]
xor ecx, esp
call fcn.0042f713
add esp, 0x1f8
ret
mov eax, dword [esp + 0x220]
push ebx
test eax, eax
je 0x50884b
mov esi, dword [esp + 0x18]
mov ecx, 1
cmp eax, esi
mov byte [esp + 0x13], cl
mov ebx, eax
mov eax, ecx
cmovg ebx, esi
shr eax, 0x18
mov byte [esp + 0x10], al
mov eax, ecx
shr eax, 0x10
mov byte [esp + 0x11], al
mov eax, ecx
shr eax, 8
mov byte [esp + 0x12], al
lea eax, [esp + 0xf4]
push eax
lea eax, [esp + 0x28]
push eax
call fcn.00519bc0
add esp, 8
test eax, eax
je 0x508897
push dword [esp + 0x218]
lea eax, [esp + 0x28]
push dword [esp + 0x24]
push eax
call fcn.00519f50
add esp, 0xc
test eax, eax
je 0x508879
push 4
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x2c]
push eax
call fcn.00519f50
add esp, 0xc
test eax, eax
je 0x508879
push 0
lea eax, [esp + 0x1c8]
push eax
lea eax, [esp + 0x2c]
push eax
call fcn.00519c90
add esp, 0xc
test eax, eax
je 0x508879
lea eax, [esp + 0x24]
push eax
call fcn.00519b90
push ebx
lea eax, [esp + 0x1cc]
push eax
push ebp
call fcn.00452210
add esp, 0x10
mov dword [esp + 0x14], 1
cmp dword [esp + 0x21c], 1
jle 0x508828
nop word [eax + eax]
lea eax, [esp + 0xf4]
push eax
lea eax, [esp + 0x28]
push eax
call fcn.00519bc0
add esp, 8
test eax, eax
je 0x508897
push esi
lea eax, [esp + 0x1c8]
push eax
lea eax, [esp + 0x2c]
push eax
call fcn.00519f50
add esp, 0xc
test eax, eax
je 0x508879
push 0
lea eax, [esp + 0x1c8]
push eax
lea eax, [esp + 0x2c]
push eax
call fcn.00519c90
add esp, 0xc
test eax, eax
je 0x508879
lea eax, [esp + 0x24]
push eax
call fcn.00519b90
add esp, 4
xor esi, esi
test ebx, ebx
jle 0x50880e
cmp ebx, 0x20
jb 0x5087eb
lea ecx, [ebp - 1]
lea eax, [esp + ebx + 0x1c3]
add ecx, ebx
cmp ebp, eax
ja 0x508791
lea eax, [esp + 0x1c4]
cmp ecx, eax
jae 0x5087eb
mov eax, ebx
and eax, 0x8000001f
jns 0x50879f
dec eax
or eax, 0xffffffe0
inc eax
mov edx, ebx
lea edi, [esp + 0x1c4]
sub edx, eax
mov ecx, ebp
mov eax, ebp
neg eax
add edi, eax
lea eax, [esp + eax + 0x1d4]
nop dword [eax]
movups xmm0, xmmword [ecx]
add esi, 0x20
lea ecx, [ecx + 0x20]
movups xmm1, xmmword [edi + ecx - 0x20]
pxor xmm1, xmm0
movups xmmword [ecx - 0x20], xmm1
movups xmm1, xmmword [eax + ecx - 0x20]
movups xmm0, xmmword [ecx - 0x10]
pxor xmm1, xmm0
movups xmmword [ecx - 0x10], xmm1
cmp esi, edx
jl 0x5087c0
cmp esi, ebx
jge 0x50880e
lea edi, [esp + 0x1c4]
mov edx, ebx
sub edi, ebp
lea eax, [esi + ebp]
sub edx, esi
nop
mov cl, byte [edi + eax]
lea eax, [eax + 1]
xor byte [eax - 1], cl
sub edx, 1
jne 0x508800
mov esi, dword [esp + 0x14]
inc esi
cmp esi, dword [esp + 0x21c]
mov dword [esp + 0x14], esi
mov esi, dword [esp + 0x18]
jl 0x508700
mov eax, dword [esp + 0x224]
add ebp, ebx
mov ecx, dword [esp + 0x1c]
sub eax, ebx
inc ecx
mov dword [esp + 0x224], eax
mov dword [esp + 0x1c], ecx
test eax, eax
jne 0x508625
lea eax, [esp + 0xf4]
push eax
call fcn.00519b90
add esp, 4
mov eax, 1
mov ecx, dword [esp + 0x204]
pop ebx
pop edi
pop esi
pop ebp
xor ecx, esp
call fcn.0042f713
add esp, 0x1f8
ret
lea eax, [esp + 0xf4]
push eax
call fcn.00519b90
lea eax, [esp + 0x28]
push eax
call fcn.00519b90
add esp, 8
xor eax, eax
jmp 0x508860
lea eax, [esp + 0xf4]
push eax
call fcn.00519b90
add esp, 4
xor eax, eax
jmp 0x508860