Function at 0x509ea0
Capabilities:
Encode data using xor

Disassembly:
mov eax, 0x14
call fcn.005343b0
push ebx
mov ebx, dword [esp + 0x1c]
xor ecx, ecx
push ebp
mov ebp, dword [esp + 0x2c]
mov eax, dword [ebx + 0x174]
mov edx, dword [ebx + 0x160]
mov dword [esp + 0xc], eax
mov eax, dword [ebx + 0x164]
mov dword [esp + 0x14], eax
mov eax, ebp
add eax, dword [ebx + 0x38]
mov dword [esp + 0x18], edx
adc ecx, dword [ebx + 0x3c]
cmp ecx, 0xf
ja 0x50a0c0
jb 0x509ef0
cmp eax, 0xffffffe0
ja 0x50a0c0
cmp dword [ebx + 0x16c], 0
mov dword [ebx + 0x38], eax
mov dword [ebx + 0x3c], ecx
je 0x509f16
lea eax, [ebx + 0x60]
push eax
lea eax, [ebx + 0x40]
push eax
call edx
add esp, 8
mov dword [ebx + 0x16c], 0
mov eax, dword [ebx + 0xc]
push esi
mov esi, dword [esp + 0x28]
push edi
mov edi, dword [ebx + 0x168]
mov dword [esp + 0x18], edi
mov dword [esp + 0x34], esi
bswap eax
mov dword [esp + 0x10], eax
test edi, edi
je 0x509f93
mov edx, dword [esp + 0x30]
mov dword [esp + 0x28], edx
nop
test ebp, ebp
je 0x509f7a
mov al, byte [edi + ebx + 0x10]
dec ebp
mov cl, byte [esi]
inc esi
xor al, cl
mov dword [esp + 0x34], esi
mov byte [edx], al
lea eax, [edi + ebx]
xor byte [eax + 0x40], cl
inc edx
inc edi
mov dword [esp + 0x28], edx
and edi, 0xf
mov dword [esp + 0x18], edi
jne 0x509f40
lea eax, [ebx + 0x60]
push eax
lea eax, [ebx + 0x40]
push eax
call dword [esp + 0x28]
add esp, 8
jmp 0x509f9b
test edi, edi
jne 0x50a0b0
lea eax, [ebx + 0x60]
push eax
lea eax, [ebx + 0x40]
push eax
call dword [esp + 0x28]
add esp, 8
jmp 0x509f9b
mov eax, dword [esp + 0x30]
mov dword [esp + 0x28], eax
cmp ebp, 0xc00
jb 0x50a015
mov edi, dword [esp + 0x28]
lea ecx, [ebx + 0x60]
mov eax, 0xaaaaaaab
mul ebp
shr edx, 0xb
mov dword [esp + 0x34], edx
push 0xc00
push esi
push ecx
lea eax, [ebx + 0x40]
push eax
call dword [esp + 0x2c]
push ebx
push dword [esp + 0x28]
push 0xc0
push edi
push esi
call dword [esp + 0x5c]
mov ecx, dword [esp + 0x34]
add esp, 0x24
add ecx, 0xc0
add edi, 0xc00
mov dword [esp + 0x10], ecx
add esi, 0xc00
bswap ecx
sub ebp, 0xc00
mov dword [ebx + 0xc], ecx
sub dword [esp + 0x34], 1
lea ecx, [ebx + 0x60]
jne 0x509fb8
mov dword [esp + 0x28], edi
mov edi, dword [esp + 0x18]
mov dword [esp + 0x34], esi
mov eax, ebp
and eax, 0xfffffff0
mov dword [esp + 0x20], eax
je 0x50a06a
push eax
push dword [esp + 0x38]
mov esi, eax
lea eax, [ebx + 0x60]
push eax
lea eax, [ebx + 0x40]
shr esi, 4
push eax
call dword [esp + 0x2c]
push ebx
push dword [esp + 0x28]
push esi
push dword [esp + 0x44]
push dword [esp + 0x54]
call dword [esp + 0x5c]
mov eax, dword [esp + 0x34]
add esp, 0x24
add eax, esi
mov esi, dword [esp + 0x34]
mov dword [esp + 0x10], eax
bswap eax
mov dword [ebx + 0xc], eax
mov eax, dword [esp + 0x20]
add esi, eax
add dword [esp + 0x28], eax
sub ebp, eax
test ebp, ebp
je 0x50a0b0
push dword [esp + 0x14]
lea eax, [ebx + 0x10]
push eax
mov eax, dword [ebx + 0x170]
push ebx
call eax
mov eax, dword [esp + 0x1c]
add esp, 0xc
inc eax
bswap eax
mov dword [ebx + 0xc], eax
mov eax, dword [esp + 0x28]
sub esi, eax
lea edx, [edi + eax]
mov cl, byte [esi + edx]
lea eax, [ebx + edi]
xor byte [eax + 0x40], cl
lea edx, [edx + 1]
mov al, byte [ebx + edi + 0x10]
inc edi
xor al, cl
mov byte [edx - 1], al
sub ebp, 1
jne 0x50a095
mov dword [ebx + 0x168], edi
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x14
ret
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x14
ret