Function at 0x516400
Capabilities:
Encode data using xor

Disassembly:
mov eax, 8
call fcn.005650a0
mov ecx, dword [esp + 0x18]
push esi
mov esi, dword [esp + 0x10]
mov eax, dword [esi + 0x174]
mov dword [esp + 0x10], eax
xor eax, eax
add ecx, dword [esi + 0x38]
adc eax, dword [esi + 0x3c]
cmp eax, 0xf
ja 0x51662c
jb 0x516439
cmp ecx, 0xffffffe0
ja 0x51662c
cmp dword [esi + 0x16c], 0
mov dword [esi + 0x38], ecx
mov dword [esi + 0x3c], eax
je 0x516462
lea ecx, [esi + 0x60]
push ecx
lea edx, [esi + 0x40]
push edx
call fcn.00515780
add esp, 8
mov dword [esi + 0x16c], 0
movzx eax, byte [esi + 0xd]
movzx ecx, byte [esi + 0xe]
movzx edx, byte [esi + 0xf]
push ebx
movzx ebx, byte [esi + 0xc]
shl ebx, 8
or ebx, eax
shl ebx, 8
or ebx, ecx
push ebp
mov ebp, dword [esi + 0x168]
shl ebx, 8
or ebx, edx
push edi
mov edi, dword [esp + 0x24]
test ebp, ebp
je 0x5164d3
cmp dword [esp + 0x28], 0
je 0x5164bb
mov al, byte [esi + ebp + 0x10]
mov ecx, dword [esp + 0x20]
xor al, byte [ecx]
dec dword [esp + 0x28]
mov byte [edi], al
xor byte [esi + ebp + 0x40], al
inc ecx
inc ebp
inc edi
and ebp, 0xf
mov dword [esp + 0x20], ecx
jne 0x516492
jmp 0x5164c3
test ebp, ebp
jne 0x51661c
lea eax, [esi + 0x60]
push eax
lea ecx, [esi + 0x40]
push ecx
call fcn.00515780
add esp, 8
mov ecx, dword [esp + 0x28]
cmp ecx, 0xc00
jb 0x516557
mov eax, 0xaaaaaaab
mul ecx
shr edx, 0xb
mov dword [esp + 0x10], edx
lea ecx, [ecx]
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x20]
push esi
push edx
push 0xc0
push edi
push eax
call dword [esp + 0x40]
add ebx, 0xc0
mov eax, ebx
shr eax, 8
mov byte [esi + 0xe], al
push 0xc00
lea eax, [esi + 0x60]
mov ecx, ebx
shr ecx, 0x18
push eax
mov edx, ebx
lea eax, [esi + 0x40]
mov byte [esi + 0xc], cl
shr edx, 0x10
push eax
mov ecx, edi
mov byte [esi + 0xd], dl
mov byte [esi + 0xf], bl
call fcn.00515900
mov eax, 0xc00
add dword [esp + 0x40], eax
sub dword [esp + 0x48], eax
add esp, 0x20
add edi, eax
sub dword [esp + 0x10], 1
jne 0x5164f0
mov ecx, dword [esp + 0x28]
mov eax, ecx
and eax, 0xfffffff0
mov dword [esp + 0x10], eax
je 0x5165c0
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x20]
push esi
push ecx
shr eax, 4
push eax
push edi
push edx
mov dword [esp + 0x28], eax
call dword [esp + 0x40]
add ebx, dword [esp + 0x28]
mov eax, ebx
shr eax, 0x18
mov byte [esi + 0xc], al
mov eax, dword [esp + 0x24]
add dword [esp + 0x34], eax
sub dword [esp + 0x3c], eax
push eax
mov ecx, ebx
shr ecx, 0x10
mov byte [esi + 0xd], cl
lea eax, [esi + 0x60]
push eax
lea ecx, [esi + 0x40]
mov edx, ebx
shr edx, 8
push ecx
mov ecx, edi
mov byte [esi + 0xe], dl
mov byte [esi + 0xf], bl
call fcn.00515900
mov ecx, dword [esp + 0x48]
add esp, 0x20
add edi, dword [esp + 0x10]
test ecx, ecx
je 0x51661c
mov edx, dword [esp + 0x1c]
mov ecx, dword [esi + 0x170]
push edx
lea eax, [esi + 0x10]
push eax
push esi
call ecx
inc ebx
mov edx, ebx
shr edx, 0x18
mov ecx, ebx
shr ecx, 8
mov byte [esi + 0xc], dl
mov edx, dword [esp + 0x2c]
mov eax, ebx
shr eax, 0x10
add esp, 0xc
mov byte [esi + 0xe], cl
mov byte [esi + 0xd], al
mov byte [esi + 0xf], bl
lea ecx, [edi + ebp]
sub edx, edi
mov edi, edi
mov al, byte [esi + ebp + 0x10]
xor al, byte [edx + ecx]
mov edi, dword [esp + 0x28]
mov byte [ecx], al
xor byte [esi + ebp + 0x40], al
dec edi
inc ebp
inc ecx
mov dword [esp + 0x28], edi
test edi, edi
jne 0x516600
pop edi
mov dword [esi + 0x168], ebp
pop ebp
pop ebx
xor eax, eax
pop esi
add esp, 8
ret
or eax, 0xffffffff
pop esi
add esp, 8
ret