Function at 0x40390c
Capabilities:
Parse pe header
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffe68
push ebx
push esi
push edi
xor ebx, ebx
mov dword [ebp - 0x1c], ebx
mov dword [ebp - 0x34], ebx
mov dword [ebp - 0x38], ebx
mov ebx, ecx
mov dword [ebp - 8], edx
mov dword [ebp - 4], eax
mov eax, dword [ebp - 4]
call fcn.00401acc
mov eax, dword [ebp - 8]
call fcn.00401acc
lea esi, [ebp - 0x198]
xor eax, eax
push ebp
push 0x403c66
push dword fs:[eax]
mov dword fs:[eax], esp
mov byte [ebp - 9], 0
xor eax, eax
mov dword [ebp - 0x2c], eax
lea eax, [ebp - 0x1c]
mov edx, dword [ebp - 8]
call fcn.00401808
mov dword [ebp - 0x28], ebx
mov eax, dword [ebp - 0x1c]
call fcn.004018e4
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x18]
add eax, 2
push eax
lea eax, [ebp - 0x34]
mov ecx, 1
mov edx, dword [0x4038bc]
call fcn.004021f8
add esp, 4
mov eax, dword [ebp - 0x18]
push eax
lea eax, [ebp - 0x38]
mov ecx, 1
mov edx, dword [0x4038e4]
call fcn.004021f8
add esp, 4
mov eax, dword [ebp - 0x34]
mov byte [eax], 0x2e
mov ebx, dword [ebp - 0x18]
dec ebx
test ebx, ebx
jl 0x4039ca
inc ebx
xor eax, eax
mov edx, dword [ebp - 8]
mov dl, byte [edx + eax]
mov ecx, dword [ebp - 0x34]
mov byte [ecx + eax + 1], dl
inc eax
dec ebx
jne 0x4039b9
mov eax, dword [ebp - 0x34]
mov edx, dword [ebp - 0x18]
mov byte [eax + edx + 1], 0
push 0
push 0x80
push 3
push 0
push 3
push 0xc0000000
mov eax, dword [ebp - 4]
call fcn.00401adc
push eax
call sub.KERNEL32.DLL_CreateFileA
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0xffffffff
je 0x403c27
push ebp
push 0x403c20
push dword fs:[0]
mov dword fs:[0], esp
push 0
lea eax, [ebp - 0x20]
push eax
push 0x40
lea eax, [ebp - 0x78]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_ReadFile
cmp word [ebp - 0x78], 0x5a4d
je 0x403a3d
call fcn.00401370
jmp 0x403c27
push 0
push 0
mov eax, dword [ebp - 0x3c]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_SetFilePointer
push 0
lea eax, [ebp - 0x20]
push eax
push 0xf8
lea eax, [ebp - 0x170]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_ReadFile
cmp dword [ebp - 0x170], 0x4550
je 0x403a7f
call fcn.00401370
jmp 0x403c27
mov eax, dword [ebp - 0x13c]
add eax, dword [ebp - 0x148]
mov dword [ebp - 0x30], eax
xor edi, edi
xor eax, eax
mov dword [ebp - 0x14], eax
movzx ebx, word [ebp - 0x16a]
dec ebx
test ebx, ebx
jl 0x403ae8
inc ebx
push 0
lea eax, [ebp - 0x20]
push eax
push 0x28
push esi
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_ReadFile
mov eax, dword [esi + 0xc]
cmp eax, dword [ebp - 0x148]
mov edx, dword [esi + 0x14]
mov dword [0x4161b8], edx
mov edx, dword [esi + 0x10]
mov ecx, dword [esi + 0x14]
add ecx, edx
cmp edi, ecx
jae 0x403ad8
mov edi, dword [esi + 0x14]
add edi, dword [esi + 0x10]
mov edx, eax
add edx, dword [esi + 8]
cmp edx, dword [ebp - 0x14]
jbe 0x403ae5
mov dword [ebp - 0x14], edx
dec ebx
jne 0x403aa2
mov ecx, dword [ebp - 0x18]
add ecx, 2
mov edx, esi
mov eax, dword [ebp - 0x34]
call fcn.004011ec
mov eax, dword [ebp - 0x28]
mov dword [esi + 8], eax
mov eax, dword [ebp - 0x14]
mov dword [esi + 0xc], eax
mov eax, dword [ebp - 0x28]
mov dword [esi + 0x10], eax
mov dword [esi + 0x14], edi
xor eax, eax
mov dword [esi + 0x18], eax
xor eax, eax
mov dword [esi + 0x1c], eax
mov word [esi + 0x20], 0
mov ebx, dword [esi + 0xc]
mov eax, ebx
mov ecx, dword [ebp - 0x138]
xor edx, edx
div ecx
test edx, edx
jbe 0x403b3c
mov eax, ebx
xor edx, edx
div ecx
inc eax
imul ecx
mov dword [esi + 0xc], eax
mov ebx, dword [esi + 8]
mov eax, ebx
xor edx, edx
div ecx
test edx, edx
jbe 0x403b55
mov eax, ebx
xor edx, edx
div ecx
inc eax
imul ecx
mov dword [esi + 8], eax
mov dword [esi + 0x24], 0xe00000e0
push 0
lea eax, [ebp - 0x24]
push eax
push 0x28
push esi
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_WriteFile
mov eax, dword [esi + 8]
add dword [ebp - 0x120], eax
inc word [ebp - 0x16a]
push 0
push 0
mov eax, dword [ebp - 0x3c]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_SetFilePointer
push 0
lea eax, [ebp - 0x24]
push eax
push 0xf8
lea eax, [ebp - 0x170]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_WriteFile
push 0
push 0
mov eax, dword [esi + 0x14]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_SetFilePointer
mov ebx, dword [ebp - 0x28]
test ebx, ebx
jle 0x403bda
push 0
lea eax, [ebp - 0x24]
push eax
push 1
lea eax, [ebp - 0x2c]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_WriteFile
dec ebx
jne 0x403bc2
push 0
push 0
mov eax, dword [esi + 0x14]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_SetFilePointer
push 0
lea eax, [ebp - 0x24]
push eax
push 4
lea eax, [ebp - 0x30]
push eax
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_WriteFile
cmp eax, 1
sbb eax, eax
inc eax
mov byte [ebp - 9], al
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x403c27
mov eax, dword [ebp - 0x10]
push eax
call sub.KERNEL32.DLL_CloseHandle
ret
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x403c6d
lea eax, [ebp - 0x38]
mov edx, dword [0x4038e4]
call fcn.00402204
lea eax, [ebp - 0x34]
mov edx, dword [0x4038bc]
call fcn.00402204
lea eax, [ebp - 0x1c]
call fcn.00401770
lea eax, [ebp - 8]
mov edx, 2
call fcn.00401794
ret