Function at 0x40d3da
Capabilities:
Get file size
Parse pe header
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x58
mov eax, dword [0x45900c]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
push esi
mov esi, dword [ebp + 0xc]
push edi
mov edi, ecx
mov dword [ebp - 0x54], eax
mov eax, dword [ebp + 0x10]
push edi
mov dword [ebp - 0x50], edx
mov dword [ebp - 0x58], eax
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 1
je 0x40d417
mov eax, 0x1000000
jmp 0x40d5c0
lea eax, [ebp - 0x38]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetFileInformationByHandle]
test eax, eax
jne 0x40d430
mov eax, 0x200
jmp 0x40d5c0
mov ebx, dword [ebp - 0x38]
mov edx, ebx
and edx, 1
mov eax, ebx
mov ecx, edx
mov dword [ebp - 0x3c], edx
or ecx, 2
and al, 2
mov eax, ebx
cmove ecx, edx
mov edx, ecx
or edx, 4
and al, 4
cmove edx, ecx
mov ecx, ebx
mov eax, edx
or eax, 0x10
and ecx, 0x10
cmove eax, edx
mov edx, eax
or edx, 0x20
and bl, 0x20
cmove edx, eax
test ecx, ecx
je 0x40d477
or edx, 0x40000000
jmp 0x40d47d
or edx, 0x80000000
or edx, 0x1000000
mov ebx, edx
or ebx, 0x800000
cmp dword [ebp - 0x3c], 0
push 0
push edi
cmovne ebx, edx
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov dword [ebp - 0x3c], eax
mov ecx, ebx
cmp eax, 0x28
jbe 0x40d54b
xor eax, eax
push eax
push eax
push eax
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x44]
push eax
push 2
lea eax, [ebp - 0x40]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push 0
push 0
push 0x24
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x44]
push eax
push 4
lea eax, [ebp - 0x48]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, 0x54ad
mov ecx, ebx
cmp word [ebp - 0x40], ax
jne 0x40d548
mov edx, dword [ebp - 0x48]
lea eax, [edx + 0x34]
cmp dword [ebp - 0x3c], eax
jbe 0x40d548
push 0
push 0
push edx
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x44]
push eax
push 4
lea eax, [ebp - 0x4c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [ebp - 0x4c]
cmp eax, 0x5a4d
je 0x40d540
cmp eax, 0x454e
je 0x40d540
cmp eax, 0x454c
je 0x40d540
mov ecx, ebx
cmp eax, 0x4550
jne 0x40d548
mov ecx, ebx
or ecx, 0x400000
mov eax, dword [ebp - 0x3c]
mov edx, dword [ebp - 0x50]
test edx, edx
je 0x40d554
mov dword [edx], ecx
mov ecx, dword [ebp - 0x54]
test ecx, ecx
je 0x40d55d
mov dword [ecx], eax
test esi, esi
je 0x40d596
push dword [ebp - 0x28]
push dword [ebp - 0x2c]
call fcn.0040d31b
push dword [ebp - 0x20]
mov dword [esi], eax
push dword [ebp - 0x24]
mov dword [esi + 4], edx
call fcn.0040d31b
push dword [ebp - 0x30]
mov dword [esi + 8], eax
push dword [ebp - 0x34]
mov dword [esi + 0xc], edx
call fcn.0040d31b
add esp, 0x18
mov dword [esi + 0x10], eax
mov dword [esi + 0x14], edx
mov esi, dword [ebp - 0x58]
test esi, esi
je 0x40d5be
lea eax, [ebp - 0x3c]
push eax
lea eax, [ebp - 0x40]
push eax
lea eax, [ebp - 0x24]
push eax
call dword [sym.imp.KERNEL32.dll_FileTimeToDosDateTime]
movzx ecx, word [ebp - 0x40]
movzx eax, word [ebp - 0x3c]
shl ecx, 0x10
or ecx, eax
mov dword [esi], ecx
xor eax, eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00417ff1
mov esp, ebp
pop ebp
ret