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

Disassembly:
sub esp, 0x70
push ebx
mov ebx, dword [esp + 0x78]
push 1
push ebx
call fcn.00409658
mov edx, eax
add esp, 8
test edx, edx
je 0x40a4d0
test ebx, ebx
jne 0x40a12c
cmp dword [0x41cc34], 2
jne 0x40a0c7
cmp dword [0x42469c], 0
je 0x40a12c
mov eax, dword [0x41e708]
push eax
call fcn.0040c960
push ebx
push pe_nt_image_headers32
push 3
push ebx
push 1
push 0x80000000
push 0x41c9b0
call sub.kernel32.dll_CreateFileA
mov dword [0x41c9ac], eax
mov eax, dword [0x41e5cc]
push eax
call fcn.0040c960
mov edx, dword [0x41c9ac]
add esp, 8
cmp edx, 0xffffffff
je 0x40a11f
push edx
call sub.kernel32.dll_CloseHandle
push 0x75
call fcn.00405aec
add esp, 4
cmp eax, 6
je 0x40a12c
cmp dword [0x41c9ac], 0xffffffff
jne 0x40a09c
cmp dword [0x41cc34], 2
jne 0x40a144
push 0
call fcn.00417e50
add esp, 4
jmp 0x40a4d2
cmp byte [0x41cab4], 0
je 0x40a4ad
mov eax, dword [0x41e708]
push eax
call fcn.0040c960
push 0
push pe_nt_image_headers32
push 2
push 0
push 0
push 0x40000000
push 0x41c9b0
call sub.kernel32.dll_CreateFileA
mov edx, eax
add esp, 4
mov dword [0x41c9ac], edx
cmp edx, 0xffffffff
je 0x40a49c
mov eax, dword [0x423c74]
mov dword [0x41d0cc], 0xdecade00
movsx eax, word [eax + 4]
cmp dword [0x424770], eax
je 0x40a1b1
mov dword [0x41d0cc], 0xdecade01
push 0
push 0x41d0d0
push 4
push 0x41d0cc
push edx
call sub.kernel32.dll_WriteFile
test eax, eax
je 0x40a49c
cmp dword [0x41d0d0], 4
jne 0x40a49c
mov ax, word [0x426920]
add eax, 0xfffff049
mov word [esp + 0x36], ax
mov ax, word [0x426924]
mov word [esp + 0x38], ax
mov ax, word [0x426928]
mov word [esp + 0x3a], ax
mov ax, word [0x426804]
mov word [esp + 0x3c], ax
mov ax, word [0x41dcf0]
mov word [esp + 0x3e], ax
mov ax, word [0x423c50]
mov word [esp + 0x40], ax
mov ax, word [0x425010]
mov word [esp + 0x42], ax
mov ax, word [0x425080]
mov word [esp + 0x44], ax
mov ax, word [0x425078]
mov word [esp + 0x46], ax
mov ebx, 0x88888889
mov eax, dword [0x42507c]
imul ebx
add edx, dword [0x42507c]
mov eax, edx
sar eax, 5
mov dword [esp + 4], eax
mov eax, dword [0x42507c]
sar eax, 0x1f
mov dword [esp + 0x30], eax
mov eax, dword [esp + 4]
sub eax, dword [esp + 0x30]
mov word [esp + 0x34], 1
mov word [esp + 0x48], ax
mov ax, word [0x41c454]
mov word [esp + 0x4a], ax
mov ecx, dword [0x41c458]
mov eax, ecx
imul ebx
add edx, ecx
mov eax, edx
sar eax, 5
mov dword [esp + 4], eax
mov eax, ecx
sar eax, 0x1f
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 4]
sub eax, dword [esp + 0x2c]
mov dword [esp + 4], eax
mov eax, dword [esp + 4]
mov word [esp + 0x4c], ax
mov eax, dword [esp + 4]
shl eax, 4
sub eax, dword [esp + 4]
shl eax, 2
mov dword [esp + 0x20], eax
sub ecx, dword [esp + 0x20]
mov ax, word [0x41c45c]
mov word [esp + 0x4e], cx
mov word [esp + 0x50], ax
mov ecx, dword [0x41c460]
mov eax, ecx
imul ebx
add edx, ecx
mov eax, edx
sar eax, 5
mov dword [esp + 4], eax
mov eax, ecx
sar eax, 0x1f
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 4]
sub eax, dword [esp + 0x1c]
mov dword [esp + 4], eax
mov eax, dword [esp + 4]
mov word [esp + 0x52], ax
mov eax, dword [esp + 4]
shl eax, 4
sub eax, dword [esp + 4]
shl eax, 2
mov dword [esp + 0x10], eax
mov ax, word [0x425084]
mov word [esp + 0x56], ax
mov ax, word [0x42476c]
lea edx, [esp + 0x5c]
mov word [esp + 0x58], ax
mov ax, word [0x424770]
sub ecx, dword [esp + 0x10]
mov word [esp + 0x5a], ax
mov word [esp + 0x54], cx
lea eax, [esp + 0x74]
cmp edx, eax
jae 0x40a36c
mov word [edx], 0
lea eax, [esp + 0x74]
add edx, 2
cmp edx, eax
jb 0x40a35c
push 0
push 0x41d0d0
push 0x40
lea eax, [esp + 0x40]
push eax
mov eax, dword [0x41c9ac]
push eax
call sub.kernel32.dll_WriteFile
test eax, eax
je 0x40a49c
cmp dword [0x41d0d0], 0x40
jne 0x40a49c
push 0
push 0x41d0d0
push 8
push 0x41c44c
mov eax, dword [0x41c9ac]
push eax
call sub.kernel32.dll_WriteFile
test eax, eax
je 0x40a49c
mov edx, dword [0x41d0d0]
cmp edx, 8
jne 0x40a49c
push 0
push 0x41d0d0
push edx
push 0x41c468
mov eax, dword [0x41c9ac]
push eax
call sub.kernel32.dll_WriteFile
test eax, eax
je 0x40a49c
cmp dword [0x41d0d0], 8
jne 0x40a49c
push 0
push 0x41d0d0
push 0x66
push 0x423240
mov eax, dword [0x41c9ac]
push eax
call sub.kernel32.dll_WriteFile
test eax, eax
je 0x40a49c
cmp dword [0x41d0d0], 0x66
jne 0x40a49c
push 0
push 0x41d0d0
mov eax, dword [0x423c74]
mov dword [esp + 0xc], eax
movsx eax, word [eax + 4]
mov dword [esp + 0x14], eax
add eax, eax
mov dword [esp + 0x10], eax
push eax
mov eax, dword [esp + 0x10]
push eax
mov eax, dword [0x41c9ac]
push eax
call sub.kernel32.dll_WriteFile
mov edx, eax
test edx, edx
je 0x40a49c
mov eax, dword [0x423c74]
movsx eax, word [eax + 4]
add eax, eax
cmp dword [0x41d0d0], eax
jne 0x40a49c
mov eax, dword [0x41c9ac]
push eax
call sub.kernel32.dll_CloseHandle
test eax, eax
je 0x40a49c
mov eax, dword [0x41e5cc]
push eax
call fcn.0040c960
call fcn.004095b0
push 0x41cab4
call fcn.004108c8
mov eax, 1
add esp, 8
jmp 0x40a4d2
mov edx, dword [0x41c9ac]
cmp edx, 0xffffffff
je 0x40a4ad
push edx
call sub.kernel32.dll_CloseHandle
mov eax, dword [0x41e5cc]
push eax
call fcn.0040c960
push 0x41c9b0
push 1
call fcn.004094f8
call fcn.00409590
xor eax, eax
add esp, 0xc
jmp 0x40a4d2
mov eax, edx
pop ebx
add esp, 0x70
ret