Function at 0x409140
Capabilities:
Read file on windows
Resolve function by parsing pe exports
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff0
sub esp, 0xf8
mov eax, dword [0x4d044c]
xor eax, esp
mov dword [esp + 0xf4], eax
push esi
push edi
mov edi, ecx
mov dword [esp + 0x2c], edx
mov eax, dword [edi + 0xc]
mov dword [esp + 0x18], eax
xor eax, eax
mov dword [esp + 0x24], eax
call dword [sym.imp.KERNEL32.dll_GetVersion]
movzx eax, al
mov ecx, 5
cmp ecx, eax
sbb eax, eax
and eax, 0xc00
add eax, 0x400
xor ecx, ecx
mov dword [edi + 0x8c], eax
mov esi, dword [esp + 0x40]
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x20], ecx
nop
lea eax, [esp + 0x84]
mov dword [esp + 0x8c], ecx
push eax
lea eax, [esp + 0x2c]
xorps xmm0, xmm0
push eax
push 0x5c
lea eax, [esp + 0xa4]
movlpd qword [esp + 0x90], xmm0
push eax
push dword [edi]
movlpd qword [esp + 0xa4], xmm0
call dword [sym.imp.KERNEL32.dll_ReadFile]
or ecx, 0xffffffff
test eax, eax
cmovne ecx, dword [esp + 0x28]
cmp ecx, 0xffffffff
je 0x409461
cmp ecx, 0x5c
jne 0x4093a6
test byte [esp + 0x9e], 8
je 0x40938d
cmp dword [esp + 0xa4], 0xbeefc0de
jne 0x40938d
cmp dword [esp + 0xa8], 1
jne 0x409374
mov ecx, dword [esp + 0x1c]
test ecx, ecx
je 0x40924c
cmp dword [esp + 0x2c], 0
mov eax, dword [esp + 0xf0]
je 0x409240
cmp eax, dword [esp + 0x7c]
jmp 0x409244
cmp dword [esp + 0x7c], eax
sbb eax, eax
neg eax
test eax, eax
je 0x40928d
movups xmm0, xmmword [esp + 0xa4]
movups xmmword [esp + 0x30], xmm0
movups xmm0, xmmword [esp + 0xb4]
movups xmmword [esp + 0x40], xmm0
movups xmm0, xmmword [esp + 0xc4]
movups xmmword [esp + 0x50], xmm0
movups xmm0, xmmword [esp + 0xd4]
movups xmmword [esp + 0x60], xmm0
movups xmm0, xmmword [esp + 0xe4]
movups xmmword [esp + 0x70], xmm0
mov eax, dword [esp + 0x20]
mov esi, dword [esp + 0x40]
inc eax
add ecx, esi
mov dword [esp + 0x20], eax
mov dword [esp + 0x1c], ecx
cmp eax, 2
jl 0x4091a0
mov edx, dword [esp + 0x78]
mov eax, dword [esp + 0x3c]
mov dword [edi + 0x10], esi
mov ecx, dword [edi + 0x4c]
test ecx, ecx
jne 0x4092c0
mov dword [edi + 0x4c], eax
mov ecx, eax
lea eax, [edx + 1]
imul eax, esi
cmp ecx, eax
jae 0x4092cf
mov dword [edi + 0x4c], eax
mov ecx, eax
mov esi, dword [esp + 0x24]
mov dword [esp + 0x3c], ecx
test esi, esi
je 0x4092f7
test byte [esp + 0x18], 1
jne 0x409485
lea edx, [esp + 0x30]
mov ecx, edi
call fcn.00408930
test eax, eax
jne 0x409360
xor esi, esi
and dword [esp + 0x18], 1
mov edx, 0
mov ecx, edi
cmovne edx, dword [esp + 0x38]
call fcn.00408d30
test eax, eax
jne 0x409360
test esi, esi
je 0x409331
cmp dword [esp + 0x18], eax
je 0x409322
mov eax, dword [edi + 0x30]
mov dword [esp + 0x38], eax
lea edx, [esp + 0x30]
mov ecx, edi
call fcn.00408930
test eax, eax
jne 0x409360
mov esi, dword [edi + 0x10]
xor edx, edx
lea ecx, [esi - 0xc]
mov eax, ecx
shr ecx, 1
shr eax, 2
and ecx, 0x7ffffffe
dec eax
sub ecx, 2
mov dword [edi + 0x80], eax
mov eax, dword [edi + 0x4c]
div esi
mov dword [edi + 0x84], ecx
mov dword [edi + 0x54], eax
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0xf4]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
mov eax, 0xffff87b6
pop edi
pop esi
mov ecx, dword [esp + 0xf4]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
mov eax, 0xffff87b7
pop edi
pop esi
mov ecx, dword [esp + 0xf4]
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret
test ecx, ecx
je 0x409470
jns 0x40947b
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x4092a9
cmp eax, 2
jne 0x409360
mov esi, dword [edi + 0x14]
mov dword [esp + 0x24], 1
mov dword [edi + 0x10], esi
cmp esi, 0x8000
jbe 0x4093e9
mov dword [edi + 0x10], 0x8000
mov esi, 0x8000
xor eax, eax
mov dword [esp + 0x38], 0
mov word [esp + 0x56], ax
xorps xmm0, xmm0
mov dword [esp + 0x7c], eax
mov edx, 1
mov ax, word [edi + 0xc]
or ax, 8
movlpd qword [esp + 0x46], xmm0
mov word [esp + 0x44], ax
mov eax, 0x100000
movlpd qword [esp + 0x4e], xmm0
movlpd qword [esp + 0x5c], xmm0
movlpd qword [esp + 0x64], xmm0
movlpd qword [esp + 0x6c], xmm0
mov dword [esp + 0x30], 0xbeefc0de
mov dword [esp + 0x34], 1
mov dword [esp + 0x40], esi
mov dword [esp + 0x78], edx
mov dword [esp + 0x58], 0xffffffff
mov dword [esp + 0x74], 0xffffffff
jmp 0x4092b4
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x26
jne 0x4093b4
cmp dword [esp + 0x1c], 0
je 0x4093c7
mov eax, 0xffff87b7
jmp 0x4093ba
push 0
lea eax, [esp + 0x84]
mov byte [esp + 0x1b], 0
push eax
push 1
lea eax, [esp + 0x23]
push eax
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4092f7
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0xfc]
pop edi
pop esi
xor ecx, esp
call fcn.004606ac
mov esp, ebp
pop ebp
ret