Function at 0x58f170
Capabilities:
Encode data using xor

Disassembly:
mov eax, 0x30
call fcn.005eb280
mov eax, dword [0x6bae70]
xor eax, esp
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x3c]
push ebx
push ebp
push esi
mov esi, dword [esp + 0x40]
push edi
mov dword [esp + 0x14], eax
mov dword [esp + 0x24], esi
mov bl, byte [esi]
mov edi, dword [esi + 0x28]
mov eax, dword [esi + 0x2c]
mov byte [esp + 0x13], bl
mov dword [esp + 0x18], edi
mov dword [esp + 0x1c], eax
test bl, 0x40
jne 0x58f1bd
push eax
lea eax, [esi + 0x10]
push eax
push esi
call edi
add esp, 0xc
movzx eax, bl
mov edx, 0xf
and eax, 7
xor ecx, ecx
sub edx, eax
mov byte [esi], al
mov dword [esp + 0x28], edx
cmp edx, 0xf
jae 0x58f1f3
jmp 0x58f1e0
movzx eax, byte [esi + edx]
or ecx, eax
mov byte [esi + edx], 0
inc edx
shl ecx, 8
cmp edx, 0xf
jb 0x58f1e0
movzx eax, byte [esi + 0xf]
mov ebp, dword [esp + 0x50]
or ecx, eax
mov byte [esi + 0xf], 1
cmp ecx, ebp
je 0x58f21b
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
mov ecx, dword [esp + 0x2c]
xor ecx, esp
call fcn.005e9734
add esp, 0x30
ret
mov ebx, dword [esp + 0x48]
cmp ebp, 0x10
jb 0x58f2be
mov edi, 0xfffffff8
mov eax, ebp
sub edi, esi
shr eax, 4
mov dword [esp + 0x20], eax
jmp 0x58f240
push dword [esp + 0x1c]
lea eax, [esp + 0x30]
push eax
push esi
call dword [esp + 0x24]
add esp, 0xc
lea eax, [esi + 0x10]
inc byte [eax - 1]
lea eax, [eax - 1]
jne 0x58f263
lea ecx, [edi + eax]
test ecx, ecx
jne 0x58f254
mov ecx, dword [ebx]
mov eax, dword [ebx + 4]
mov edx, dword [esp + 0x14]
xor eax, dword [esp + 0x30]
xor ecx, dword [esp + 0x2c]
push dword [esp + 0x1c]
mov dword [edx + 4], eax
mov dword [edx], ecx
xor dword [esi + 0x14], eax
xor dword [esi + 0x10], ecx
mov ecx, dword [ebx + 8]
mov eax, dword [ebx + 0xc]
xor eax, dword [esp + 0x3c]
xor ecx, dword [esp + 0x38]
mov dword [edx + 0xc], eax
mov dword [edx + 8], ecx
xor dword [esi + 0x1c], eax
lea eax, [esi + 0x10]
xor dword [esi + 0x18], ecx
push eax
push eax
call dword [esp + 0x24]
add dword [esp + 0x20], 0x10
add esp, 0xc
add ebx, 0x10
sub ebp, 0x10
dec dword [esp + 0x20]
jne 0x58f240
mov edi, dword [esp + 0x18]
test ebp, ebp
je 0x58f327
push dword [esp + 0x1c]
lea eax, [esp + 0x30]
push eax
push esi
call edi
add esp, 0xc
xor edi, edi
test ebp, ebp
je 0x58f312
lea eax, [esp + 0x2c]
sub ebx, eax
sub dword [esp + 0x14], eax
lea eax, [esi + 0x10]
mov esi, dword [esp + 0x14]
mov dword [esp + 0x20], eax
lea esp, [esp]
lea ecx, [esp + 0x2c]
add ecx, edi
movzx edx, byte [ebx + ecx]
movzx eax, byte [ecx]
xor edx, eax
mov eax, dword [esp + 0x20]
mov byte [esi + ecx], dl
xor byte [eax + edi], dl
inc edi
cmp edi, ebp
jb 0x58f2f0
mov esi, dword [esp + 0x24]
mov ebx, dword [esp + 0x1c]
lea eax, [esi + 0x10]
mov edi, dword [esp + 0x18]
push ebx
push eax
push eax
call edi
add esp, 0xc
jmp 0x58f32b
mov ebx, dword [esp + 0x1c]
mov edx, dword [esp + 0x28]
cmp edx, 0x10
jae 0x58f352
mov ecx, 0x10
lea edi, [edx + esi]
sub ecx, edx
xor eax, eax
mov edx, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov edi, dword [esp + 0x18]
push ebx
lea eax, [esp + 0x30]
push eax
push esi
call edi
mov eax, dword [esp + 0x38]
add esp, 0xc
xor dword [esi + 0x10], eax
mov eax, dword [esp + 0x30]
xor dword [esi + 0x14], eax
mov eax, dword [esp + 0x34]
xor dword [esi + 0x18], eax
mov eax, dword [esp + 0x38]
xor dword [esi + 0x1c], eax
mov al, byte [esp + 0x13]
mov ecx, dword [esp + 0x3c]
pop edi
mov byte [esi], al
xor eax, eax
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.005e9734
add esp, 0x30
ret