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

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x8c
lea edi, [esp + 0x48]
mov dword [esp + 8], 0x38
mov dword [esp + 4], 0x419044
mov dword [esp], edi
mov dword [esp + 0x30], eax
mov dword [esp + 0x1c], 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.0040b260
mov ebp, eax
test eax, eax
jne 0x4018f4
mov dword [esp], 0x2000
call sub.msvcrt.dll_malloc
mov esi, eax
test eax, eax
je 0x401939
mov dword [esp], 0x2000
call sub.msvcrt.dll_malloc
test eax, eax
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x1c]
je 0x401919
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 0x401880
mov eax, dword [esp + 0x20]
mov ebp, dword [esp + 0x30]
mov dword [esp + 4], 1
mov dword [esp], esi
mov dword [esp + 0xc], ebp
mov ebx, eax
mov dword [esp + 8], eax
call sub.msvcrt.dll_fread
cmp eax, ebx
mov dword [esp + 0x34], eax
jne 0x4018e0
mov dword [esp], ebp
call sub.msvcrt.dll_ferror
mov ebp, eax
test eax, eax
jne 0x4018e0
mov edx, dword [esp + 0x34]
mov dword [esp + 0x48], esi
mov dword [esp + 0x4c], edx
mov dword [esp + 4], 0
mov eax, dword [esp + 0x18]
mov dword [esp], edi
mov dword [esp + 0x58], 0x2000
mov dword [esp + 0x54], eax
call fcn.0040b340
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 0x401898
mov dword [esp + 0xc], eax
mov eax, dword [esp + 0x18]
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 0x4018ea
mov eax, dword [esp + 0x38]
mov dword [esp], eax
call sub.msvcrt.dll_ferror
test eax, eax
jne 0x4018ea
mov edx, dword [esp + 0x58]
test edx, edx
je 0x401753
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 ecx, eax
or ecx, edx
jne 0x4016e3
mov ebx, dword [esp + 0x34]
cmp ebx, 1
je 0x401856
jmp 0x401836
cmp eax, 2
jne 0x401787
mov ebx, 0xfffffffd
mov edx, dword [esp + 0x1c]
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.00403030
mov dword [esp], edi
call fcn.0040d550
mov dword [esp], esi
call sub.msvcrt.dll_free
mov eax, dword [esp + 0x18]
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 0x401707
mov eax, dword [esp + 0xa0]
test eax, eax
je 0x4017e2
mov eax, dword [esp + 0x18]
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 0x4017e2
mov ebp, 0xffffffff
jmp 0x401856
mov ebx, 0xffffffff
jmp 0x401836
mov dword [esp + 8], eax
mov eax, dword [esp + 0x1c]
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.00403030
jmp 0x401872
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], str.malloc
call fcn.00403190
jmp 0x401856
mov eax, dword [esp + 0x1c]
mov dword [esp + 4], str.Failed_to_extract__s:_failed_to_allocate_temporary_input_buffer__n
mov dword [esp], str.malloc
add eax, 0x12
mov dword [esp + 8], eax
call fcn.00403190
mov dword [esp + 0x18], 0
jmp 0x401856