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

Disassembly:
push ebp
push edi
mov edi, eax
push esi
push ebx
sub esp, 0x8c
lea eax, [esp + 0x48]
mov dword [esp + 8], 0x38
mov dword [esp + 4], 0x418044
mov dword [esp], eax
mov dword [esp + 0x30], edx
mov dword [esp + 0x38], ecx
mov dword [esp + 0x68], 0
mov dword [esp + 0x6c], 0
mov dword [esp + 0x70], 0
mov dword [esp + 0x4c], 0
mov dword [esp + 0x48], 0
call fcn.00409210
mov ebp, eax
test eax, eax
jne 0x401904
mov dword [esp], 0x2000
call sub.msvcrt.dll_malloc
mov esi, eax
test eax, eax
je 0x401949
mov dword [esp], 0x2000
call sub.msvcrt.dll_malloc
test eax, eax
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x30]
je 0x401929
mov eax, dword [eax + 8]
xor edx, edx
mov dword [esp + 0x2c], edx
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x2c]
mov ecx, 0x2000
cmp ecx, eax
mov ecx, 0
mov dword [esp + 0x20], eax
sbb ecx, edx
mov dword [esp + 0x24], edx
jb 0x401888
mov edx, dword [esp + 0x20]
mov eax, dword [edi]
mov dword [esp + 4], 1
mov dword [esp], esi
mov dword [esp + 0xc], eax
mov ebx, edx
mov dword [esp + 8], edx
call sub.msvcrt.dll_fread
cmp eax, ebx
mov dword [esp + 0x34], eax
jne 0x4018f0
mov eax, dword [edi]
mov dword [esp], eax
call sub.msvcrt.dll_ferror
mov ebp, eax
test eax, eax
jne 0x4018f0
mov edx, dword [esp + 0x34]
mov dword [esp + 0x48], esi
mov dword [esp + 0x4c], edx
mov eax, dword [esp + 0x1c]
mov dword [esp + 4], 0
mov dword [esp + 0x58], 0x2000
mov dword [esp + 0x54], eax
lea eax, [esp + 0x48]
mov dword [esp], eax
call fcn.004092e0
mov ebx, eax
cmp eax, 0xffffffff
jge 0x401828
cmp eax, 0xfffffffc
jge 0x401836
mov edx, dword [esp + 0x58]
mov eax, dword [esp + 0x38]
mov ecx, 0x2000
sub ecx, edx
test eax, eax
je 0x4018a0
mov dword [esp + 0xc], eax
mov eax, dword [esp + 0x1c]
mov dword [esp + 8], ecx
mov dword [esp + 4], 1
mov dword [esp], eax
mov dword [esp + 0x34], ecx
call sub.msvcrt.dll_fwrite
mov ecx, dword [esp + 0x34]
cmp eax, ecx
jne 0x4018fa
mov eax, dword [esp + 0x38]
mov dword [esp], eax
call sub.msvcrt.dll_ferror
test eax, eax
jne 0x4018fa
mov edx, dword [esp + 0x58]
test edx, edx
je 0x401751
mov dword [esp + 0x34], ebx
mov ecx, dword [esp + 0x20]
mov ebx, dword [esp + 0x24]
sub dword [esp + 0x28], ecx
sbb dword [esp + 0x2c], ebx
cmp dword [esp + 0x34], 1
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x2c]
je 0x401856
mov ebx, eax
or ebx, edx
jne 0x4016e1
mov ebx, dword [esp + 0x34]
cmp ebx, 1
je 0x401856
jmp 0x401836
cmp eax, 2
jne 0x401789
mov ebx, 0xfffffffd
mov edx, dword [esp + 0x30]
mov dword [esp + 8], ebx
mov ebp, 0xffffffff
mov dword [esp], str.Failed_to_extract__s:_decompression_resulted_in_return_code__d__n
add edx, 0x12
mov dword [esp + 4], edx
call fcn.00402f00
lea eax, [esp + 0x48]
mov dword [esp], eax
call fcn.0040b4f0
mov dword [esp], esi
call sub.msvcrt.dll_free
mov eax, dword [esp + 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_free
add esp, 0x8c
mov eax, ebp
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp + 0x20], 0x2000
mov dword [esp + 0x24], 0
jmp 0x401705
mov eax, dword [esp + 0xa0]
test eax, eax
je 0x4017e4
mov eax, dword [esp + 0x1c]
mov dword [esp + 8], ecx
mov dword [esp + 0x3c], edx
mov dword [esp + 4], eax
mov eax, dword [esp + 0xa0]
mov dword [esp + 0x34], ecx
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov ecx, dword [esp + 0x34]
mov edx, dword [esp + 0x3c]
add dword [esp + 0xa0], ecx
jmp 0x4017e4
mov ebp, 0xffffffff
jmp 0x401856
mov ebx, 0xffffffff
jmp 0x401836
mov dword [esp + 8], eax
mov eax, dword [esp + 0x30]
mov ebp, 0xffffffff
mov dword [esp], str.Failed_to_extract__s:_inflateInit___failed_with_return_code__d__n
add eax, 0x12
mov dword [esp + 4], eax
call fcn.00402f00
jmp 0x401876
add eax, 0x12
mov dword [esp + 4], str.Failed_to_extract__s:_failed_to_allocate_temporary_output_buffer__n
mov dword [esp + 8], eax
mov dword [esp], 0x4180d2
call fcn.00403060
jmp 0x401856
mov eax, dword [esp + 0x30]
mov dword [esp + 4], str.Failed_to_extract__s:_failed_to_allocate_temporary_input_buffer__n
mov dword [esp], 0x4180d2
add eax, 0x12
mov dword [esp + 8], eax
call fcn.00403060
mov dword [esp + 0x1c], 0
jmp 0x401856