Function at 0x5878d0
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
xor esi, esi
cmp byte [edi + 0x17], 0
jne 0x58792f
cmp dword [edi + 4], esi
jle 0x587924
xor ebx, ebx
jmp 0x5878f0
cmp byte [edi + 0x17], 0
jne 0x587904
mov eax, dword [ebp + 0xc]
mov al, byte [esi + eax]
cmp al, 0xff
je 0x58791e
cmp al, 0xa
jbe 0x58791e
mov eax, dword [edi + 0x20]
push dword [eax + esi*4]
call fcn.00586e50
mov ecx, dword [edi + 0x824]
add esp, 4
mov dword [ebx + ecx], eax
add ebx, 4
inc esi
cmp esi, dword [edi + 4]
jl 0x5878f0
mov eax, dword [edi + 0x82c]
jmp 0x5879bc
mov eax, dword [edi + 0x82c]
test eax, eax
jle 0x5879bc
lea ecx, [ecx]
mov eax, dword [edi + 0x20]
mov ecx, dword [eax + esi*4]
mov edx, ecx
shr edx, 1
lea eax, [ecx + ecx]
xor edx, eax
lea eax, [ecx + ecx]
and edx, 0x55555555
xor edx, eax
mov ecx, edx
shr ecx, 2
lea eax, [edx*4]
xor ecx, eax
lea eax, [edx*4]
and ecx, 0x33333333
xor ecx, eax
mov edx, ecx
mov eax, ecx
shl eax, 4
shr edx, 4
xor edx, eax
shl ecx, 4
and edx, 0xf0f0f0f
xor edx, ecx
mov ecx, edx
mov eax, edx
shr ecx, 8
shl eax, 8
xor ecx, eax
shl edx, 8
mov eax, dword [edi + 0x824]
and ecx, 0xff00ff
xor ecx, edx
rol ecx, 0x10
mov dword [eax + esi*4], ecx
inc esi
mov eax, dword [edi + 0x82c]
cmp esi, eax
jl 0x587940
push 0x513e20
push 4
push eax
push dword [edi + 0x824]
call sym.BZDPatcher.exe_SDL_qsort
mov ecx, dword [edi + 0x82c]
add esp, 0x10
mov eax, dword [edi + 0x824]
mov dword [eax + ecx*4], 0xffffffff
cmp byte [edi + 0x17], 0
je 0x5879f3
mov eax, dword [edi + 0x82c]
jmp 0x5879f6
mov eax, dword [edi + 4]
xor esi, esi
mov dword [ebp - 0xc], eax
mov dword [ebp - 8], esi
test eax, eax
jle 0x587b15
mov cl, byte [edi + 0x17]
mov byte [ebp - 1], cl
test cl, cl
je 0x587a18
mov eax, dword [ebp + 0x10]
mov eax, dword [eax + esi*4]
jmp 0x587a1a
mov eax, esi
mov edx, dword [ebp + 0xc]
mov al, byte [eax + edx]
mov byte [ebp - 2], al
test cl, cl
jne 0x587a37
cmp al, 0xff
je 0x587b08
cmp al, 0xa
jbe 0x587b08
mov eax, dword [edi + 0x20]
xor ebx, ebx
mov ecx, dword [eax + esi*4]
mov edx, ecx
shr edx, 1
lea eax, [ecx + ecx]
xor edx, eax
lea eax, [ecx + ecx]
and edx, 0x55555555
xor edx, eax
mov ecx, edx
shr ecx, 2
lea eax, [edx*4]
xor ecx, eax
lea eax, [edx*4]
and ecx, 0x33333333
xor ecx, eax
mov edx, ecx
mov eax, ecx
shr edx, 4
shl eax, 4
xor edx, eax
shl ecx, 4
and edx, 0xf0f0f0f
xor edx, ecx
mov ecx, edx
mov eax, edx
shr ecx, 8
shl eax, 8
xor ecx, eax
shl edx, 8
mov eax, dword [edi + 0x82c]
and ecx, 0xff00ff
xor ecx, edx
rol ecx, 0x10
mov dword [ebp - 0x10], ecx
cmp eax, 1
jle 0x587ae4
mov edx, dword [edi + 0x824]
mov edi, ecx
mov dword [ebp - 0x14], edx
lea ebx, [ebx]
mov ecx, eax
sar ecx, 1
sub eax, ecx
lea esi, [ecx + ebx]
mov edx, dword [edx + esi*4]
cmp edx, edi
mov edx, dword [ebp - 0x14]
cmova eax, ecx
cmova esi, ebx
mov ebx, esi
cmp eax, 1
jg 0x587ac0
mov edi, dword [ebp + 8]
mov esi, dword [ebp - 8]
cmp byte [ebp - 1], 0
mov eax, dword [edi + 0x828]
lea ecx, [eax + ebx*4]
je 0x587b06
mov eax, dword [ebp + 0x10]
mov eax, dword [eax + esi*4]
mov dword [ecx], eax
mov eax, dword [edi + 8]
mov cl, byte [ebp - 2]
mov byte [ebx + eax], cl
jmp 0x587b08
mov dword [ecx], esi
inc esi
mov dword [ebp - 8], esi
cmp esi, dword [ebp - 0xc]
jl 0x587a06
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret