Function at 0x8519f1
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x3c
mov ebx, dword [esp + 0x50]
mov esi, dword [esp + 0x54]
mov eax, dword [ebx + 0x1028]
cmp eax, 4
je 0x851bc1
cmp eax, 6
je 0x851e91
cmp eax, 7
je 0x851df1
cmp eax, 8
jne 0x851f78
mov edi, dword [ebx + 0x1004]
mov ebp, dword [ebx + 0x1000]
mov eax, dword [ebx + 0x1018]
mov edx, dword [ebx + 0x101c]
mov dword [esp + 0x18], eax
mov eax, dword [ebx + 0x1010]
mov dword [esp + 0x1c], edx
sub eax, dword [esp + 0x18]
mov edx, dword [ebx + 0x1014]
sbb edx, dword [esp + 0x1c]
mov dword [esp + 0x20], eax
mov dword [esp + 0x24], edx
cmp ebp, edi
je 0x851ba9
mov edx, dword [esp + 0x20]
mov eax, edi
mov dword [esp + 0x2c], 0
sub eax, ebp
mov ecx, dword [esp + 0x24]
cmp eax, edx
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x2c]
sbb eax, ecx
jae 0x851bb3
movzx eax, byte [ebx + 0x1020]
mov ecx, eax
test al, al
je 0x851b79
mov eax, dword [ebx + 0x1000]
mov edx, dword [esp + 0x18]
cmp edi, eax
je 0x851f71
lea esi, [esi]
lea esi, [esi]
and edx, 3
movzx edx, byte [ebx + edx + 0x1021]
xor byte [eax], dl
mov eax, dword [ebx + 0x1000]
mov edx, dword [ebx + 0x1018]
mov ecx, dword [ebx + 0x101c]
add eax, 1
add edx, 1
adc ecx, 0
mov dword [ebx + 0x1000], eax
mov dword [ebx + 0x1018], edx
mov dword [ebx + 0x101c], ecx
cmp eax, edi
jne 0x851ac1
mov dword [esp + 0x18], edx
sub eax, ebp
mov dword [esp + 0x1c], ecx
movzx ecx, byte [ebx + 0x1020]
mov edi, eax
movzx eax, byte [ebx + 0x1008]
mov byte [esi], al
movzx eax, byte [ebx + 0x100a]
mov byte [esi + 1], al
movzx eax, byte [ebx + 0x1009]
mov byte [esi + 2], al
mov eax, dword [ebx + 0x1010]
mov edx, dword [ebx + 0x1014]
mov byte [esi + 0x10], cl
mov dword [esi + 8], eax
xor eax, dword [esp + 0x18]
mov dword [esi + 0xc], edx
xor edx, dword [esp + 0x1c]
or edx, eax
mov dword [esi + 0x14], ebp
mov dword [esi + 0x18], edi
jne 0x851b6a
mov dword [ebx + 0x1028], 4
mov dword [ebx + 0x102c], 2
add esp, 0x3c
mov eax, edi
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [ebx + 0x1000], edi
sub edi, ebp
mov eax, edi
cdq
add dword [esp + 0x18], edi
mov eax, dword [esp + 0x18]
adc dword [esp + 0x1c], edx
mov edx, dword [esp + 0x1c]
mov dword [ebx + 0x1018], eax
mov dword [ebx + 0x101c], edx
jmp 0x851b12
mov edi, edx
or edi, eax
jne 0x851db1
mov edi, dword [esp + 0x20]
add edi, ebp
jmp 0x851a94
mov edi, dword [ebx + 0x1004]
mov edx, dword [ebx + 0x1000]
mov eax, edi
sub eax, edx
cmp eax, dword [ebx + 0x102c]
jb 0x851ec9
movzx eax, byte [edx]
mov ecx, eax
shr cl, 7
mov byte [esp + 0x18], cl
mov ecx, eax
shr al, 4
and ecx, 0xf
and eax, 7
mov byte [ebx + 0x1009], cl
mov byte [esp + 0x20], cl
movzx ecx, byte [esp + 0x18]
mov byte [ebx + 0x100a], al
lea eax, [edx + 1]
add edx, 2
mov byte [ebx + 0x1008], cl
movzx ecx, byte [esp + 0x20]
mov dword [ebx + 0x1000], eax
movzx eax, byte [edx - 1]
shr al, 7
mov byte [ebx + 0x1020], al
movzx ebp, byte [edx - 1]
mov dword [ebx + 0x1000], edx
and ebp, 0x7f
shr cl, 3
jne 0x851e31
mov ecx, ebp
cmp cl, 0x7e
jne 0x851f39
mov dword [ebx + 0x1028], 6
mov ecx, 2
mov dword [ebx + 0x102c], 2
sub edi, edx
cmp edi, ecx
jae 0x851c9a
mov eax, ebx
call fcn.008510a1
mov edi, eax
test eax, eax
jle 0x851b6a
mov edx, dword [ebx + 0x1000]
mov eax, dword [ebx + 0x1004]
mov ecx, dword [ebx + 0x102c]
sub eax, edx
cmp eax, ecx
jb 0x851d9d
mov dword [ebx + 0x1010], 0
mov eax, ebx
mov dword [ebx + 0x1014], 0
sub eax, ecx
mov dword [ebx + 0x1018], 0
add eax, 0x1018
mov dword [ebx + 0x101c], 0
mov dword [esp + 8], ecx
mov dword [esp + 4], edx
mov dword [esp], eax
call fcn.0086e9f1
mov eax, dword [ebx + 0x1010]
mov edx, dword [ebx + 0x1014]
mov dword [esp], eax
mov dword [esp + 4], edx
call fcn.00851f91
mov ecx, dword [ebx + 0x1000]
mov edi, dword [ebx + 0x102c]
mov dword [esp + 0x18], eax
add ecx, edi
mov dword [esp + 0x1c], edx
mov dword [ebx + 0x1010], eax
mov dword [ebx + 0x1014], edx
mov dword [ebx + 0x1000], ecx
cmp edi, 8
je 0x851f01
mov edi, 0x7d
mov eax, 0
cmp edi, dword [esp + 0x18]
sbb eax, dword [esp + 0x1c]
jae 0x851f29
cmp byte [ebx + 0x1020], 0
je 0x851eb1
mov edi, dword [ebx + 0x1004]
mov edx, 4
mov dword [ebx + 0x1028], 7
mov dword [ebx + 0x102c], 4
mov eax, edi
sub eax, ecx
cmp eax, edx
jae 0x851e0f
mov eax, ebx
call fcn.008510a1
mov edi, eax
test eax, eax
jle 0x851b6a
mov edi, dword [ebx + 0x1004]
mov ecx, dword [ebx + 0x1000]
mov eax, edi
sub eax, ecx
cmp eax, dword [ebx + 0x102c]
jae 0x851e0f
mov edi, 0xffffff9c
jmp 0x851b6a
mov eax, ebx
call fcn.008510a1
mov edi, eax
test eax, eax
jle 0x851b6a
mov eax, dword [ebx + 0x1018]
mov edx, dword [ebx + 0x101c]
mov edi, dword [ebx + 0x1004]
mov ebp, dword [ebx + 0x1000]
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], edx
jmp 0x851a6e
mov edi, dword [ebx + 0x1004]
mov ecx, dword [ebx + 0x1000]
mov eax, edi
mov edx, dword [ebx + 0x102c]
sub eax, ecx
cmp eax, edx
jb 0x851d74
mov eax, dword [ecx]
lea ebp, [ecx + 4]
mov dword [ebx + 0x1028], 8
mov dword [ebx + 0x1000], ebp
mov dword [ebx + 0x1021], eax
jmp 0x851a36
mov edx, ebp
cmp dl, 0x7d
ja 0x851f29
cmp byte [esp + 0x18], 0
je 0x851f29
mov dword [ebx + 0x1014], 0
mov ecx, ebp
mov dword [ebx + 0x1018], 0
movzx edx, cl
mov dword [ebx + 0x1010], edx
mov dword [ebx + 0x101c], 0
test al, al
je 0x851f61
mov dword [ebx + 0x1028], 7
mov dword [ebx + 0x102c], 4
jmp 0x851df7
mov edx, dword [ebx + 0x1000]
mov ecx, dword [ebx + 0x102c]
mov edi, dword [ebx + 0x1004]
jmp 0x851c67
mov dword [ebx + 0x1028], 8
mov edi, dword [ebx + 0x1004]
jmp 0x851a30
mov eax, ebx
call fcn.008510a1
mov edi, eax
test eax, eax
jle 0x851b6a
mov edi, dword [ebx + 0x1004]
mov edx, dword [ebx + 0x1000]
mov eax, edi
sub eax, edx
cmp eax, dword [ebx + 0x102c]
jae 0x851bdd
jmp 0x851d9d
add eax, 0xffff0000
mov edi, 0xfffeffff
adc edx, 0xffffffff
mov dword [esp + 0x18], eax
mov eax, 0x7fffffff
cmp edi, dword [esp + 0x18]
mov dword [esp + 0x1c], edx
sbb eax, dword [esp + 0x1c]
jae 0x851d3c
mov edi, 0xffffff38
jmp 0x851b6a
cmp cl, 0x7f
jne 0x851e47
mov dword [ebx + 0x1028], 6
mov ecx, 8
mov dword [ebx + 0x102c], 8
jmp 0x851c67
mov dword [ebx + 0x1028], 8
jmp 0x851a30
sub edi, ebp
jmp 0x851b12
mov edi, 0xfffffed4
jmp 0x851b6a