Function at 0x586470
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x24
push ebx
push ebp
push esi
mov esi, dword [esp + 0x34]
mov al, byte [esi + 8]
push edi
lea edi, [esi + 8]
mov ebp, dword [esi]
mov dword [esp + 0x18], ebp
test al, al
jne 0x586732
mov edx, dword [esp + 0x40]
test edx, edx
je 0x58649d
movzx ecx, word [edx + 8]
jmp 0x58649f
xor ecx, ecx
mov al, byte [esi + 9]
mov dword [esp + 0x14], ecx
cmp al, 8
jae 0x58660d
movzx eax, al
sub eax, 1
je 0x5865a5
sub eax, 1
je 0x58653d
sub eax, 2
jne 0x5865fc
mov edx, dword [esp + 0x3c]
and ecx, 0xf
mov eax, ecx
mov ebx, 4
shl ecx, 4
add ecx, eax
lea eax, [ebp - 1]
mov edi, eax
mov dword [esp + 0x14], ecx
and eax, 1
shr edi, 1
shl eax, 2
lea ecx, [edx - 1]
add edi, edx
add ecx, ebp
sub ebx, eax
test ebp, ebp
je 0x5865f8
mov esi, ecx
nop
mov dl, byte [edi]
lea esi, [esi - 1]
mov cl, bl
shr dl, cl
mov ecx, 4
mov al, dl
shl dl, 4
and al, 0xf
xor al, dl
cmp ebx, 4
mov byte [esi + 1], al
lea eax, [edi - 1]
cmovne eax, edi
mov edi, eax
xor eax, eax
cmp ebx, 4
cmovne eax, ecx
mov ebx, eax
sub ebp, 1
jne 0x586500
mov ebp, dword [esp + 0x18]
jmp 0x5865f4
and ecx, 3
lea eax, [ebp - 1]
imul ecx, ecx, 0x55
mov edi, eax
shr edi, 2
and eax, 3
mov ebx, 3
sub ebx, eax
add ebx, ebx
mov dword [esp + 0x14], ecx
mov ecx, dword [esp + 0x3c]
add edi, ecx
dec ecx
add ecx, ebp
test ebp, ebp
je 0x5865fc
mov esi, ecx
nop
mov dl, byte [edi]
mov cl, bl
shr dl, cl
and dl, 3
mov al, dl
shl al, 2
or al, dl
shl al, 2
or al, dl
shl al, 2
or al, dl
mov byte [esi], al
cmp ebx, 6
jne 0x586596
xor ebx, ebx
dec edi
jmp 0x586599
add ebx, 2
dec esi
sub ebp, 1
jne 0x586570
mov ebp, dword [esp + 0x18]
jmp 0x5865f4
and ecx, 1
lea eax, [ebp - 1]
imul ecx, ecx, 0xff
mov edi, eax
shr edi, 3
and eax, 7
mov edx, 7
sub edx, eax
mov dword [esp + 0x14], ecx
mov ecx, dword [esp + 0x3c]
add edi, ecx
lea ebx, [ecx - 1]
add ebx, ebp
test ebp, ebp
je 0x5865f8
mov esi, ebp
mov al, byte [edi]
mov cl, dl
shr al, cl
and al, 1
neg al
sbb al, al
mov byte [ebx], al
cmp edx, 7
jne 0x5865ed
xor edx, edx
dec edi
jmp 0x5865ee
inc edx
dec ebx
sub esi, 1
jne 0x5865d5
mov esi, dword [esp + 0x38]
mov edx, dword [esp + 0x40]
lea ebx, [esi + 4]
mov byte [esi + 9], 8
mov byte [esi + 0xb], 8
mov al, 8
mov dword [ebx], ebp
jmp 0x586610
lea ebx, [esi + 4]
test edx, edx
je 0x5868f2
cmp al, 8
jne 0x586664
mov eax, dword [esp + 0x14]
movzx eax, al
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x3c]
lea edx, [eax - 1]
add edx, ebp
lea edi, [eax - 1]
lea edi, [edi + ebp*2]
test ebp, ebp
je 0x5866f8
mov ebx, ebp
movzx eax, byte [edx]
lea edi, [edi - 2]
sub eax, dword [esp + 0x38]
lea edx, [edx - 1]
neg eax
sbb al, al
mov byte [edi + 2], al
mov al, byte [edx + 1]
mov byte [edi + 1], al
sub ebx, 1
jne 0x586640
jmp 0x5866f5
cmp al, 0x10
jne 0x5866f8
mov eax, dword [esp + 0x14]
mov ecx, eax
shr ecx, 8
mov dword [esp + 0x20], ecx
mov ecx, dword [esp + 0x3c]
movzx eax, al
mov dword [esp + 0x24], eax
mov eax, dword [ebx]
lea edx, [ecx - 1]
add edx, eax
lea ecx, [ecx + eax*2]
dec ecx
test ebp, ebp
je 0x5866f8
mov dword [esp + 0x1c], ebp
mov ebp, dword [esp + 0x20]
nop dword [eax + eax]
movzx eax, byte [edx - 1]
mov dword [esp + 0x20], ecx
cmp eax, ebp
jne 0x5866ba
movzx eax, byte [edx]
cmp eax, dword [esp + 0x24]
jne 0x5866ba
dec ecx
xor al, al
jmp 0x5866bd
dec ecx
or al, 0xff
mov esi, dword [esp + 0x20]
mov ebx, ecx
mov dword [esp + 0x14], 0xffffffff
mov byte [esi], al
mov byte [ecx], al
mov ecx, dword [esp + 0x14]
mov al, byte [edx]
mov byte [ecx + ebx], al
add ecx, ebx
mov al, byte [edx - 1]
sub edx, 2
mov byte [ecx - 1], al
sub ecx, 2
sub dword [esp + 0x1c], 1
jne 0x5866a0
mov esi, dword [esp + 0x38]
mov ebp, dword [esp + 0x18]
lea ebx, [esi + 4]
mov al, byte [esi + 9]
add al, al
mov byte [esi + 8], 4
mov byte [esi + 0xa], 2
mov byte [esi + 0xb], al
movzx ecx, al
cmp al, 8
jb 0x58671f
shr ecx, 3
imul ecx, ebp
pop edi
pop esi
pop ebp
mov dword [ebx], ecx
pop ebx
add esp, 0x24
ret
imul ecx, ebp
pop edi
pop esi
pop ebp
add ecx, 7
shr ecx, 3
mov dword [ebx], ecx
pop ebx
add esp, 0x24
ret
cmp al, 2
jne 0x5868f2
mov eax, dword [esp + 0x40]
test eax, eax
je 0x5868f2
mov cl, byte [esi + 9]
lea ebx, [esi + 9]
cmp cl, 8
jne 0x5867d9
mov cl, byte [eax + 2]
mov byte [esp + 0x12], cl
mov cl, byte [eax + 4]
mov al, byte [eax + 6]
mov byte [esp + 0x38], cl
mov ecx, dword [esp + 0x3c]
mov byte [esp + 0x13], al
mov eax, dword [esi + 4]
lea edx, [ecx - 1]
lea ecx, [ecx + ebp*4]
add edx, eax
dec ecx
test ebp, ebp
je 0x5868bf
mov ah, byte [esp + 0x38]
mov dword [esp + 0x1c], ebp
nop word [eax + eax]
mov al, byte [esp + 0x12]
cmp byte [edx - 2], al
jne 0x5867aa
cmp byte [edx - 1], ah
jne 0x5867aa
mov al, byte [esp + 0x13]
cmp byte [edx], al
jne 0x5867aa
xor al, al
jmp 0x5867ac
or al, 0xff
mov byte [ecx], al
or ebx, 0xffffffff
mov al, byte [edx]
mov edi, ecx
lea ecx, [ebx + edi]
mov byte [ebx + edi], al
mov al, byte [edx - 1]
mov byte [ecx - 1], al
mov al, byte [edx - 2]
sub edx, 3
mov byte [ecx - 2], al
sub ecx, 3
sub dword [esp + 0x1c], 1
jne 0x586790
jmp 0x5868b9
cmp cl, 0x10
jne 0x5868bf
movzx ecx, word [eax + 2]
mov dword [esp + 0x20], ecx
shr ecx, 8
mov dword [esp + 0x24], ecx
movzx ecx, word [eax + 4]
movzx eax, word [eax + 6]
mov dword [esp + 0x14], ecx
shr ecx, 8
mov dword [esp + 0x1c], ecx
mov ecx, dword [esp + 0x3c]
mov dword [esp + 0x2c], eax
shr eax, 8
mov dword [esp + 0x28], eax
lea edx, [ecx - 1]
add edx, dword [esi + 4]
lea ecx, [ecx + ebp*8]
dec ecx
test ebp, ebp
je 0x5868bf
mov dword [esp + 0x38], ebp
nop dword [eax]
mov eax, dword [esp + 0x24]
mov dword [esp + 0x30], ecx
cmp byte [edx - 5], al
jne 0x58686d
mov eax, dword [esp + 0x20]
cmp byte [edx - 4], al
jne 0x58686d
mov eax, dword [esp + 0x1c]
cmp byte [edx - 3], al
jne 0x58686d
mov eax, dword [esp + 0x14]
cmp byte [edx - 2], al
jne 0x58686d
mov eax, dword [esp + 0x28]
cmp byte [edx - 1], al
jne 0x58686d
mov eax, dword [esp + 0x2c]
cmp byte [edx], al
jne 0x58686d
xor al, al
jmp 0x58686f
or al, 0xff
mov ebp, dword [esp + 0x30]
dec ecx
or ebx, 0xffffffff
mov edi, ecx
mov byte [ebp], al
mov byte [ecx], al
lea ecx, [ebx + edi]
mov al, byte [edx]
mov byte [ebx + edi], al
mov al, byte [edx - 1]
mov byte [ecx - 1], al
mov al, byte [edx - 2]
mov byte [ecx - 2], al
mov al, byte [edx - 3]
mov byte [ecx - 3], al
mov al, byte [edx - 4]
mov byte [ecx - 4], al
mov al, byte [edx - 5]
sub edx, 6
mov byte [ecx - 5], al
sub ecx, 6
sub dword [esp + 0x38], 1
jne 0x586830
mov ebp, dword [esp + 0x18]
lea ebx, [esi + 9]
lea edi, [esi + 8]
mov al, byte [ebx]
shl al, 2
mov byte [edi], 6
mov byte [esi + 0xa], 4
mov byte [esi + 0xb], al
movzx ecx, al
cmp al, 8
jb 0x5868e6
shr ecx, 3
imul ecx, ebp
pop edi
mov dword [esi + 4], ecx
pop esi
pop ebp
pop ebx
add esp, 0x24
ret
imul ecx, ebp
add ecx, 7
shr ecx, 3
mov dword [esi + 4], ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x24
ret