Function at 0x408520
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4155eb
mov eax, dword fs:[0]
push eax
mov eax, 0x2044
call fcn.00411c50
mov eax, dword [0x41f4e4]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov eax, ecx
mov dword [ebp - 0x204c], eax
mov edi, dword [ebp + 8]
lea ecx, [ebp - 0x2040]
add eax, 0x3c
mov dword [ebp - 0x2048], edi
push eax
lea esi, [edi + 0x14]
call fcn.00401a90
cmp dword [esi + 0x14], 8
mov eax, esi
mov dword [ebp - 4], 0
jb 0x408586
mov eax, dword [esi]
push eax
lea eax, [ebp - 0x2040]
push eax
call fcn.0040b950
push esi
call fcn.00408950
add esp, 0xc
test al, al
je 0x4085cf
lea eax, [ebp - 0x2040]
push eax
lea eax, [ebp - 0x2028]
push eax
call fcn.0040bd50
push eax
mov byte [ebp - 4], 1
call fcn.00407e90
add esp, 0xc
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x2028]
call fcn.004028d0
cmp dword [ebp - 0x202c], 8
lea edx, [ebp - 0x2040]
mov dword [ebp - 0x2028], 0
cmovae edx, dword [ebp - 0x2040]
mov ecx, edx
mov dword [ebp - 0x2018], 0
mov dword [ebp - 0x2014], 7
lea esi, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x408606
sub ecx, esi
sar ecx, 1
push ecx
push edx
lea ecx, [ebp - 0x2028]
call fcn.00404c10
cmp dword [ebp - 0x2014], 8
lea eax, [ebp - 0x2028]
push 0x418024
cmovae eax, dword [ebp - 0x2028]
push eax
call sub.api_ms_win_crt_stdio_l1_1_0.dll__wfopen
mov edx, dword [ebp - 0x2014]
add esp, 8
mov ebx, eax
mov dword [ebp - 0x2044], ebx
cmp edx, 8
jb 0x40868c
mov ecx, dword [ebp - 0x2028]
lea edx, [edx*2 + 2]
mov eax, ecx
cmp edx, 0x1000
jb 0x408682
mov ecx, dword [ecx - 4]
add edx, 0x23
sub eax, ecx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x4087c5
push edx
push ecx
call fcn.00411bf3
add esp, 8
xor eax, eax
mov dword [ebp - 0x2018], 0
mov dword [ebp - 0x2014], 7
mov word [ebp - 0x2028], ax
test ebx, ebx
je 0x4087ca
lea ecx, [ebp - 0x2040]
mov dword [ebp - 4], 0xffffffff
call fcn.004028d0
mov eax, dword [ebp - 0x2048]
mov edi, dword [edi + 8]
push 0
push dword [eax]
mov ebx, dword [eax + 0xc]
mov eax, dword [ebp - 0x204c]
push dword [eax]
call sub.api_ms_win_crt_stdio_l1_1_0.dll_fseek
add esp, 0xc
test eax, eax
jne 0x40880b
nop dword [eax + eax]
test ebx, ebx
jg 0x408708
jl 0x4086fe
cmp edi, 0x2000
ja 0x408708
mov esi, edi
mov dword [ebp - 0x2048], ebx
jmp 0x408717
mov esi, 0x2000
mov dword [ebp - 0x2048], 0
mov eax, dword [ebp - 0x204c]
push dword [eax]
lea eax, [ebp - 0x2010]
push esi
push 1
push eax
call sub.api_ms_win_crt_stdio_l1_1_0.dll_fread
add esp, 0x10
cmp eax, esi
jne 0x408793
push dword [ebp - 0x2044]
lea eax, [ebp - 0x2010]
push esi
push 1
push eax
call sub.api_ms_win_crt_stdio_l1_1_0.dll_fwrite
add esp, 0x10
cmp eax, esi
jne 0x40883d
sub edi, esi
sbb ebx, dword [ebp - 0x2048]
test ebx, ebx
jg 0x408708
jl 0x408767
test edi, edi
jne 0x4086f0
push dword [ebp - 0x2044]
call sub.api_ms_win_crt_stdio_l1_1_0.dll_fclose
add esp, 4
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00411c01
mov esp, ebp
pop ebp
ret 4
push str.Failure_processing_application_bundle__possible_file_corruption.
call fcn.0040afd0
push str.I_O_failure_reading_contents_of_the_bundle.
call fcn.0040afd0
add esp, 8
mov dword [ebp - 0x2044], 0x800080a0
lea eax, [ebp - 0x2044]
push 0x41d110
push eax
call fcn.00412ac7
call sub.api_ms_win_crt_runtime_l1_1_0.dll__invalid_parameter_noinfo_noreturn
push str.Failure_processing_application_bundle.
call fcn.0040afd0
add esp, 4
lea ecx, [ebp - 0x2040]
call fcn.00407ca0
push eax
push str.Failed_to_open_file___s__for_writing
call fcn.0040afd0
add esp, 8
mov dword [ebp - 0x2044], 0x800080a0
lea eax, [ebp - 0x2044]
push 0x41d110
push eax
call fcn.00412ac7
push str.Failure_processing_application_bundle__possible_file_corruption.
call fcn.0040afd0
push str.I_O_seek_failure_within_the_bundle.
call fcn.0040afd0
add esp, 8
mov dword [ebp - 0x2044], 0x800080a0
lea eax, [ebp - 0x2044]
push 0x41d110
push eax
call fcn.00412ac7
push str.Failure_extracting_contents_of_the_application_bundle.
call fcn.0040afd0
push str.I_O_failure_when_writing_extracted_files.
call fcn.0040afd0
add esp, 8
mov dword [ebp - 0x2050], 0x800080a0
lea eax, [ebp - 0x2050]
push 0x41d110
push eax
call fcn.00412ac7
int3