Function at 0x500640
Capabilities:
Encode data using xor

Disassembly:
mov eax, 0x10
call fcn.005b2630
push esi
mov esi, dword [esp + 0x18]
mov eax, dword [esi + 0x174]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x24]
xor ecx, ecx
mov edx, eax
add edx, dword [esi + 0x38]
adc ecx, dword [esi + 0x3c]
cmp ecx, 0xf
ja 0x50093c
jb 0x50067b
cmp edx, 0xffffffe0
ja 0x50093c
mov dword [esi + 0x38], edx
mov dword [esi + 0x3c], ecx
mov ecx, dword [esi + 0x168]
xor edx, edx
mov dword [esp + 0x18], ecx
cmp dword [esi + 0x16c], edx
je 0x5006fc
cmp eax, edx
jne 0x5006ba
lea ecx, [esi + 0x60]
push ecx
lea edx, [esi + 0x40]
push edx
call fcn.004ff890
add esp, 8
mov dword [esi + 0x16c], 0
xor eax, eax
pop esi
add esp, 0x10
ret
mov ecx, dword [esi + 0x40]
mov dword [esi + 0x178], ecx
mov ecx, dword [esi + 0x44]
mov dword [esi + 0x17c], ecx
mov ecx, dword [esi + 0x48]
mov dword [esi + 0x180], ecx
mov ecx, dword [esi + 0x4c]
mov dword [esp + 0x18], 0x10
mov dword [esi + 0x184], ecx
mov ecx, dword [esp + 0x18]
mov dword [esi + 0x40], edx
mov dword [esi + 0x44], edx
mov dword [esi + 0x48], edx
mov dword [esi + 0x4c], edx
mov dword [esi + 0x16c], edx
movzx edx, byte [esi + 0xd]
push ebx
movzx ebx, byte [esi + 0xc]
shl ebx, 8
or ebx, edx
movzx edx, byte [esi + 0xe]
shl ebx, 8
or ebx, edx
movzx edx, byte [esi + 0xf]
shl ebx, 8
or ebx, edx
push ebp
mov ebp, dword [esp + 0x24]
mov edx, ecx
and edx, 0xf
push edi
mov edi, dword [esp + 0x2c]
mov dword [esp + 0x14], edx
je 0x500791
jmp 0x50073b
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x30]
test eax, eax
je 0x500762
mov al, byte [edx + esi + 0x10]
xor al, byte [ebp]
dec dword [esp + 0x30]
mov byte [edi], al
mov byte [ecx + esi + 0x178], al
inc edx
inc ecx
inc edi
inc ebp
and edx, 0xf
mov dword [esp + 0x14], edx
jne 0x500733
jmp 0x50076a
test edx, edx
jne 0x50092c
push ecx
lea eax, [esi + 0x60]
push eax
lea edx, [esi + 0x40]
lea ecx, [esi + 0x178]
push edx
call fcn.004ffa00
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x30], 0
mov ecx, dword [esp + 0x30]
add esp, 0xc
cmp eax, 0x10
jb 0x5007c1
test ecx, ecx
je 0x5007c1
push ecx
lea eax, [esi + 0x60]
push eax
lea edx, [esi + 0x40]
lea ecx, [esi + 0x178]
push edx
call fcn.004ffa00
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x30], 0
mov ecx, dword [esp + 0x30]
add esp, 0xc
cmp eax, 0xc00
jb 0x50084b
mov eax, 0xaaaaaaab
mul dword [esp + 0x30]
shr edx, 0xb
mov dword [esp + 0x18], edx
lea esp, [esp]
mov eax, dword [esp + 0x10]
push esi
push eax
push 0xc0
push edi
push ebp
call dword [esp + 0x48]
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.004ffa00
sub dword [esp + 0x50], 0xc00
add esp, 0x20
add edi, 0xc00
add ebp, 0xc00
dec dword [esp + 0x18]
jne 0x5007e0
mov ecx, dword [esp + 0x24]
mov eax, dword [esp + 0x30]
mov edx, eax
and edx, 0xfffffff0
mov dword [esp + 0x18], edx
je 0x5008b4
mov ecx, dword [esp + 0x10]
push esi
mov eax, edx
push ecx
shr eax, 4
push eax
push edi
push ebp
mov dword [esp + 0x30], eax
call dword [esp + 0x48]
add ebx, dword [esp + 0x30]
mov eax, ebx
shr eax, 0x10
mov edx, ebx
shr edx, 0x18
mov byte [esi + 0xd], al
mov eax, dword [esp + 0x2c]
sub dword [esp + 0x44], eax
push eax
mov byte [esi + 0xc], dl
mov ecx, ebx
shr ecx, 8
lea edx, [esi + 0x60]
add ebp, eax
push edx
lea eax, [esi + 0x40]
mov byte [esi + 0xe], cl
push eax
mov ecx, edi
mov byte [esi + 0xf], bl
call fcn.004ffa00
mov ecx, dword [esp + 0x44]
mov eax, dword [esp + 0x50]
add esp, 0x20
add edi, dword [esp + 0x18]
test eax, eax
je 0x50092c
mov ecx, dword [esp + 0x10]
mov eax, dword [esi + 0x170]
push ecx
lea edx, [esi + 0x10]
push edx
push esi
call eax
inc ebx
mov edx, ebx
shr edx, 0x10
mov ecx, ebx
shr ecx, 0x18
mov byte [esi + 0xd], dl
mov edx, dword [esp + 0x20]
mov eax, ebx
shr eax, 8
mov byte [esi + 0xc], cl
add esp, 0xc
lea ecx, [edx + edi]
mov byte [esi + 0xe], al
mov byte [esi + 0xf], bl
lea edx, [edx + esi + 0x10]
sub ebp, edi
jmp 0x500900
movzx ebx, byte [edx]
movzx eax, byte [ecx + ebp]
mov edi, dword [esp + 0x30]
xor eax, ebx
mov ebx, dword [esp + 0x24]
mov byte [ecx], al
dec edi
mov byte [esi + ebx + 0x178], al
inc ebx
inc edx
inc ecx
mov dword [esp + 0x30], edi
mov dword [esp + 0x24], ebx
test edi, edi
jne 0x500900
mov ecx, ebx
pop edi
pop ebp
pop ebx
mov dword [esi + 0x168], ecx
xor eax, eax
pop esi
add esp, 0x10
ret
or eax, 0xffffffff
pop esi
add esp, 0x10
ret