Function at 0x58e870
Capabilities:
Encode data using xor
Get file size
Read file on windows
Write file on windows

Disassembly:
mov eax, dword fs:[0]
push 0xffffffffffffffff
push 0x6975b1
push eax
mov dword fs:[0], esp
sub esp, 0xbc
push ebx
push ebp
mov ebp, dword [esp + 0xd4]
push esi
push edi
xor edi, edi
mov eax, dword [ebp + 8]
mov ebx, ecx
cmp eax, edi
jne 0x58e8a8
xor eax, eax
jmp 0x58ec43
mov eax, dword [ebp + 4]
cmp eax, edi
jne 0x58e8b4
mov eax, 0x6a3560
push edi
push 0x80
push 3
push edi
push edi
push SysReAllocString
push eax
call dword [sym.imp.kernel32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
jne 0x58e8f2
mov ebp, dword [ebp + 4]
cmp ebp, edi
jne 0x58e8dd
mov ebp, 0x6a3560
push ebp
push 0x6d40b4
call fcn.0044a330
add esp, 8
xor eax, eax
jmp 0x58ec43
push 0x6d40ac
lea eax, [esp + 0x40]
push ebp
push eax
call fcn.00408440
add esp, 0xc
lea ecx, [esp + 0x38]
mov dword [esp + 0xd4], edi
push ecx
push esi
mov dword [esp + 0x40], edi
call dword [sym.imp.kernel32.dll_GetFileSize]
mov ebp, eax
cmp ebp, edi
ja 0x58e95c
push esi
call dword [sym.imp.kernel32.dll_CloseHandle]
mov eax, dword [esp + 0x40]
cmp eax, edi
jne 0x58e936
mov eax, 0x6a3560
push eax
call fcn.00674ba7
add esp, 4
lea ecx, [esp + 0x3c]
mov dword [esp + 0xd4], 0xffffffff
push 1
call fcn.004031c0
xor eax, eax
jmp 0x58ec43
push ebp
call fcn.00673b05
add esp, 4
lea edx, [esp + 0x20]
mov edi, eax
mov dword [esp + 0x20], 0
push 0
push edx
push ebp
push edi
push esi
call dword [sym.imp.kernel32.dll_ReadFile]
push esi
call dword [sym.imp.kernel32.dll_CloseHandle]
xor esi, esi
mov edx, 0x816
test ebp, ebp
jle 0x58e9ba
mov al, byte [esi + edi]
xor ecx, ecx
mov cl, dh
xor cl, al
movzx ax, al
add eax, edx
mov byte [esi + edi], cl
lea edx, [eax + eax*2]
shl edx, 6
add edx, eax
shl edx, 7
inc esi
cmp esi, ebp
lea edx, [edx + eax + 0x1608]
jl 0x58e991
mov eax, dword [esp + 0x40]
test eax, eax
jne 0x58e9c7
mov eax, 0x6a3560
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push eax
call dword [sym.imp.kernel32.dll_CreateFileA]
mov esi, eax
lea eax, [esp + 0x20]
push 0
push eax
push ebp
push edi
push esi
call dword [sym.imp.kernel32.dll_WriteFile]
push esi
call dword [sym.imp.kernel32.dll_CloseHandle]
push edi
call fcn.006713a0
mov eax, dword [esp + 0x44]
add esp, 4
test eax, eax
jne 0x58ea0f
mov eax, 0x6a3560
push 0
push 0x80
push 3
push 0
push 0
push SysReAllocString
push eax
call dword [sym.imp.kernel32.dll_CreateFileA]
lea esi, [ebx + 4]
mov edi, eax
mov ecx, esi
call fcn.005945f0
lea ecx, [ebx + 0x14]
call fcn.00595550
mov ebp, dword [sym.imp.kernel32.dll_ReadFile]
lea ecx, [esp + 0x1c]
push 0
push ecx
lea edx, [esp + 0x18]
push 4
push edx
push edi
mov dword [esp + 0x24], 0
call ebp
mov al, byte [esp + 0x1b]
xor ecx, ecx
mov byte [esp + 0x28], al
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x30], ecx
mov dword [esp + 0x34], ecx
mov eax, dword [esp + 0x10]
mov byte [esp + 0xd4], 1
cmp eax, ecx
jle 0x58eaff
lea edx, [esp + 0x14]
mov dword [esp + 0x14], ecx
mov ecx, dword [ebx + 8]
push edx
push eax
push ecx
mov ecx, esi
call fcn.0062d440
mov edx, dword [esp + 0x10]
mov eax, dword [ebx + 8]
lea ecx, [esp + 0x1c]
push 0
push ecx
lea ecx, [edx*4]
push ecx
push eax
push edi
call ebp
lea edx, [esp + 0x28]
mov ecx, ebx
push edx
call fcn.00598320
test eax, eax
je 0x58eae5
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x2c]
cmp dword [ecx + eax*4], 0x38
jne 0x58ead6
mov eax, dword [ebx + 8]
cmp dword [eax], 6
je 0x58eafd
mov eax, dword [esi + 8]
mov ecx, dword [esi + 4]
push eax
push ecx
mov ecx, esi
call fcn.00632090
lea ecx, [esp + 0x28]
mov byte [esp + 0xd4], 0
call fcn.00498730
xor esi, esi
jmp 0x58ebd0
xor ecx, ecx
lea edx, [esp + 0x1c]
push ecx
push edx
lea eax, [esp + 0x2c]
push 4
push eax
push edi
call ebp
lea ecx, [esp + 0x54]
call fcn.00594220
mov eax, dword [esp + 0x24]
xor ebp, ebp
test eax, eax
mov byte [esp + 0xd4], 2
jle 0x58eba9
mov eax, dword [esp + 0x10]
xor esi, esi
test eax, eax
jle 0x58eb58
mov ecx, dword [esp + 0x2c]
mov eax, dword [ebx + 8]
mov edx, dword [ecx + esi*4]
lea ecx, [esp + edx + 0x54]
mov edx, dword [eax + esi*4]
push ecx
push edx
push edi
mov ecx, ebx
call fcn.005980f0
mov eax, dword [esp + 0x10]
inc esi
cmp esi, eax
jl 0x58eb34
mov eax, dword [esp + 0x54]
lea ecx, [esp + 0x54]
lea edx, [esp + 0x14]
push ecx
push edx
lea ecx, [esp + 0x94]
mov dword [esp + 0x1c], eax
call fcn.00594960
push eax
lea eax, [esp + 0x50]
push eax
lea ecx, [ebx + 0x14]
mov byte [esp + 0xdc], 3
call fcn.00594870
lea ecx, [esp + 0x90]
mov byte [esp + 0xd4], 2
call fcn.00594280
mov eax, dword [esp + 0x24]
inc ebp
cmp ebp, eax
jl 0x58eb2a
lea ecx, [esp + 0x54]
mov byte [esp + 0xd4], 1
call fcn.00594280
lea ecx, [esp + 0x28]
mov byte [esp + 0xd4], 0
call fcn.00498730
mov esi, 1
push edi
call dword [sym.imp.kernel32.dll_CloseHandle]
test esi, esi
jne 0x58ebfc
mov ecx, dword [esp + 0xdc]
mov eax, dword [ecx + 4]
test eax, eax
jne 0x58ebee
mov eax, 0x6a3560
push eax
push 0x6d4088
call fcn.0044a330
add esp, 8
mov eax, dword [esp + 0x40]
test eax, eax
jne 0x58ec09
mov eax, 0x6a3560
push eax
call fcn.00674ba7
mov ecx, dword [esp + 0x44]
add esp, 4
test ecx, ecx
mov dword [esp + 0xd4], 0xffffffff
je 0x58ec41
mov al, byte [ecx - 1]
test al, al
je 0x58ec37
cmp al, 0xff
je 0x58ec37
dec al
mov byte [ecx - 1], al
jmp 0x58ec41
dec ecx
push ecx
call fcn.006713a0
add esp, 4
mov eax, esi
mov ecx, dword [esp + 0xcc]
pop edi
pop esi
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0xc8
ret 4