Function at 0x5216e0
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x20
push ebx
mov ebx, ecx
mov byte [esp + 5], 0
push ebp
push esi
mov esi, dword [esp + 0x38]
mov eax, dword [ebx + 0x8cd4]
mov dword [esp + 0x18], eax
mov eax, dword [ebx + 0x10]
push edi
mov dword [esp + 0x20], ebx
mov byte [esp + 0x12], 0
mov ecx, dword [eax]
mov dword [esp + 0x28], ecx
lea ecx, [ecx*8 + 8]
sub ecx, dword [eax + 4]
mov al, byte [eax + 8]
mov byte [esp + 0x13], al
xor eax, eax
mov dword [esp + 0x18], ecx
mov ecx, dword [esp + 0x38]
mov dword [esp + 0x14], eax
cmp esi, 1
jbe 0x5217d8
cmp ecx, 0x400
jb 0x5217d8
mov edx, dword [esp + 0x34]
mov edi, ecx
shr edi, 1
nop word [eax + eax]
mov al, byte [edx + edi - 1]
lea ebp, [edi + edx]
cmp byte [ebp], al
je 0x521762
cmp al, byte [edx + edi - 2]
jne 0x521769
cmp edi, ecx
jae 0x5217d8
inc edi
jmp 0x521750
cmp edi, ecx
jae 0x5217d8
dec esi
mov ecx, ebx
push esi
push edi
push edx
call fcn.005216e0
mov eax, dword [esp + 0x38]
mov ecx, ebx
push esi
sub eax, edi
push eax
push ebp
call fcn.005216e0
mov ecx, dword [ebx + 0x10]
mov eax, dword [ecx]
mov dl, byte [ecx + 8]
mov byte [esp + 0x12], dl
lea eax, [eax*8 + 8]
sub eax, dword [ecx + 4]
mov edx, eax
mov dword [esp + 0x14], eax
and edx, 7
jbe 0x5217b8
mov eax, 8
sub eax, edx
push eax
push 0
call fcn.00522d00
mov edx, dword [ebx + 0x10]
mov eax, 8
mov ecx, dword [esp + 0x18]
and ecx, 7
mov byte [esp + 0x11], 1
sub eax, ecx
mov dword [edx + 4], eax
mov al, byte [esp + 0x13]
mov byte [edx + 8], al
mov ecx, dword [ebx + 0x10]
push 8
push 0x31
mov eax, dword [ecx]
mov dword [esp + 0x44], eax
shl eax, 3
sub eax, dword [ecx + 4]
mov dword [esp + 0x2c], eax
call fcn.00522d00
mov ecx, dword [ebx + 0x10]
push 8
push 0x41
call fcn.00522d00
mov ecx, dword [ebx + 0x10]
push 8
push 0x59
call fcn.00522d00
mov ecx, dword [ebx + 0x10]
push 8
push 0x26
call fcn.00522d00
mov ecx, dword [ebx + 0x10]
push 8
push 0x53
call fcn.00522d00
mov ecx, dword [ebx + 0x10]
push 8
push 0x59
call fcn.00522d00
mov ebx, dword [esp + 0x34]
or esi, 0xffffffff
xor edi, edi
xor ebp, ebp
mov dh, byte [ebx]
nop dword [eax]
mov dl, byte [ebx + ebp]
cmp edi, 4
jne 0x52186a
test dl, dl
je 0x521866
movzx ecx, dh
nop
mov eax, esi
shl esi, 8
shr eax, 0x18
xor eax, ecx
xor esi, dword [eax*4 + 0x5b3780]
add dl, 0xff
jne 0x521850
xor edi, edi
jmp 0x521894
mov ecx, esi
movzx eax, dl
shr ecx, 0x18
inc edi
xor ecx, eax
shl esi, 8
mov eax, 1
xor esi, dword [ecx*4 + 0x5b3780]
cmp dh, dl
movzx ecx, dh
cmovne edi, eax
movzx eax, dl
cmovne ecx, eax
mov dh, cl
inc ebp
cmp ebp, dword [esp + 0x38]
jb 0x521840
mov ebx, dword [esp + 0x20]
not esi
mov dword [esp + 0x2c], esi
xor edi, edi
mov ecx, 3
mov eax, esi
sub ecx, edi
shl ecx, 3
shr eax, cl
mov ecx, dword [ebx + 0x10]
push 8
movzx eax, al
push eax
call fcn.00522d00
inc edi
cmp edi, 4
jb 0x5218a7
push dword [esp + 0x38]
mov ecx, ebx
push dword [esp + 0x38]
call fcn.00521c10
mov edi, dword [ebx + 0x10]
mov edx, dword [edi]
lea ebp, [edx*8]
sub ebp, dword [edi + 4]
cmp byte [esp + 0x11], 0
je 0x521945
mov ecx, dword [esp + 0x14]
mov eax, ecx
sub ebp, dword [esp + 0x24]
sub eax, dword [esp + 0x18]
cmp ebp, eax
jae 0x521966
mov eax, dword [edi + 0xc]
sub edx, dword [esp + 0x3c]
je 0x521928
mov edi, dword [esp + 0x28]
mov esi, dword [esp + 0x3c]
sub esi, edi
lea ecx, [eax + edi]
mov al, byte [esi + ecx]
lea ecx, [ecx + 1]
mov byte [ecx - 1], al
sub edx, 1
jne 0x521916
mov esi, dword [esp + 0x2c]
mov edx, dword [esp + 0x18]
mov ecx, dword [ebx + 0x10]
add edx, ebp
mov eax, edx
and edx, 7
shr eax, 3
mov dword [ecx], eax
mov eax, 8
sub eax, edx
mov dword [ecx + 4], eax
mov eax, dword [esp + 0x1c]
mov dword [ebx + 0x8cd4], eax
pop edi
mov dword [ebx + eax*4 + 0x7cd4], esi
inc dword [ebx + 0x8cd4]
pop esi
pop ebp
pop ebx
add esp, 0x20
ret 0xc
mov eax, ecx
and ecx, 7
mov dword [esp + 0x14], ecx
mov ecx, 8
shr eax, 3
sub ecx, dword [esp + 0x14]
mov dword [edi + 4], ecx
mov dword [edi], eax
mov eax, dword [ebx + 0x10]
pop edi
pop esi
pop ebp
mov dword [eax + 4], ecx
mov cl, byte [esp + 6]
mov byte [eax + 8], cl
pop ebx
add esp, 0x20
ret 0xc