Function at 0x509c20
Capabilities:
Encode data using xor

Disassembly:
mov eax, 0x1c
call fcn.005343b0
mov edx, dword [esp + 0x2c]
xor ecx, ecx
push ebx
push esi
mov esi, dword [esp + 0x28]
mov eax, dword [esi + 0x170]
mov ebx, dword [esi + 0x160]
mov dword [esp + 0x14], eax
mov eax, dword [esi + 0x174]
mov dword [esp + 0x10], eax
mov eax, dword [esi + 0x164]
mov dword [esp + 0x20], eax
mov eax, edx
add eax, dword [esi + 0x38]
mov dword [esp + 0x1c], ebx
adc ecx, dword [esi + 0x3c]
cmp ecx, 0xf
ja 0x509e90
jb 0x509c7a
cmp eax, 0xffffffe0
ja 0x509e90
cmp dword [esi + 0x16c], 0
mov dword [esi + 0x38], eax
mov dword [esi + 0x3c], ecx
je 0x509ca4
lea eax, [esi + 0x60]
push eax
lea eax, [esi + 0x40]
push eax
call ebx
mov edx, dword [esp + 0x3c]
add esp, 8
mov dword [esi + 0x16c], 0
mov eax, dword [esi + 0xc]
mov ebx, dword [esp + 0x30]
push ebp
mov ebp, dword [esi + 0x168]
mov dword [esp + 0x10], ebp
bswap eax
mov dword [esp + 0xc], eax
push edi
mov edi, dword [esp + 0x34]
test ebp, ebp
je 0x509d01
test edx, edx
je 0x509cea
mov cl, byte [edi]
dec edx
mov al, byte [esi + ebp + 0x10]
inc edi
xor al, cl
mov dword [esp + 0x3c], edx
mov byte [ebx], al
inc ebx
xor byte [esi + ebp + 0x40], cl
inc ebp
and ebp, 0xf
mov dword [esp + 0x14], ebp
jne 0x509cc5
jmp 0x509cf2
test ebp, ebp
jne 0x509e80
lea eax, [esi + 0x60]
push eax
lea eax, [esi + 0x40]
push eax
call dword [esp + 0x2c]
add esp, 8
mov eax, dword [esp + 0x3c]
cmp eax, 0xc00
jb 0x509da6
mov eax, 0xaaaaaaab
lea ecx, [esi + 0x60]
mul dword [esp + 0x3c]
shr edx, 0xb
mov dword [esp + 0x24], edx
push 0xc00
push edi
push ecx
lea eax, [esi + 0x40]
push eax
call dword [esp + 0x38]
mov ebp, dword [esp + 0x20]
add esp, 0x10
mov dword [esp + 0x20], 0xc0
push dword [esp + 0x18]
lea eax, [esi + 0x10]
push eax
push esi
call dword [esp + 0x28]
inc ebp
add esp, 0xc
mov eax, ebp
bswap eax
mov dword [esi + 0xc], eax
mov eax, dword [esi + 0x10]
xor eax, dword [edi]
mov dword [ebx], eax
mov eax, dword [edi + 4]
xor eax, dword [esi + 0x14]
mov dword [ebx + 4], eax
mov eax, dword [edi + 8]
xor eax, dword [esi + 0x18]
mov dword [ebx + 8], eax
mov eax, dword [edi + 0xc]
add edi, 0x10
xor eax, dword [esi + 0x1c]
mov dword [ebx + 0xc], eax
add ebx, 0x10
sub dword [esp + 0x20], 1
jne 0x509d41
sub dword [esp + 0x3c], 0xc00
lea ecx, [esi + 0x60]
sub dword [esp + 0x24], 1
mov dword [esp + 0x10], ebp
jne 0x509d23
mov ebp, dword [esp + 0x14]
mov eax, dword [esp + 0x3c]
mov ecx, eax
and ecx, 0xfffffff0
je 0x509e32
push ecx
push edi
lea eax, [esi + 0x60]
push eax
lea eax, [esi + 0x40]
push eax
call dword [esp + 0x38]
mov eax, dword [esp + 0x4c]
add esp, 0x10
cmp eax, 0x10
jb 0x509e32
mov ebp, eax
lea ecx, [esi + 0x10]
shr eax, 4
mov dword [esp + 0x3c], eax
push dword [esp + 0x18]
push ecx
push esi
call dword [esp + 0x28]
mov eax, dword [esp + 0x1c]
lea ecx, [esi + 0x10]
inc eax
add esp, 0xc
mov dword [esp + 0x10], eax
sub ebp, 0x10
bswap eax
mov dword [esi + 0xc], eax
mov eax, dword [ecx]
xor eax, dword [edi]
mov dword [ebx], eax
mov eax, dword [edi + 4]
xor eax, dword [esi + 0x14]
mov dword [ebx + 4], eax
mov eax, dword [edi + 8]
xor eax, dword [esi + 0x18]
mov dword [ebx + 8], eax
mov eax, dword [edi + 0xc]
add edi, 0x10
xor eax, dword [esi + 0x1c]
mov dword [ebx + 0xc], eax
add ebx, 0x10
sub dword [esp + 0x3c], 1
jne 0x509dd7
mov dword [esp + 0x3c], ebp
mov ebp, dword [esp + 0x14]
mov eax, dword [esp + 0x3c]
test eax, eax
je 0x509e80
push dword [esp + 0x18]
lea eax, [esi + 0x10]
push eax
push esi
call dword [esp + 0x28]
mov eax, dword [esp + 0x1c]
add esp, 0xc
mov edx, dword [esp + 0x3c]
inc eax
bswap eax
mov dword [esi + 0xc], eax
sub edi, ebx
lea eax, [ebx + ebp]
lea ebx, [esi + 0x40]
mov dword [esp + 0x28], eax
mov esi, eax
mov cl, byte [edi + esi]
lea eax, [ebx + ebp]
xor byte [eax], cl
lea esi, [esi + 1]
mov al, byte [ebx + ebp - 0x30]
inc ebp
xor al, cl
mov byte [esi - 1], al
sub edx, 1
jne 0x509e62
mov esi, dword [esp + 0x30]
pop edi
mov dword [esi + 0x168], ebp
xor eax, eax
pop ebp
pop esi
pop ebx
add esp, 0x1c
ret
pop esi
or eax, 0xffffffff
pop ebx
add esp, 0x1c
ret