Function at 0x401509
Capabilities:
Allocate or change rwx memory
Query environment variable
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x288
mov byte [ebp - 0x244], 0xd8
mov byte [ebp - 0x243], 0xdf
mov byte [ebp - 0x242], 0xd3
mov byte [ebp - 0x241], 0xc0
mov byte [ebp - 0x240], 0xc3
mov byte [ebp - 0x23f], 0xcd
mov byte [ebp - 0x23e], pe_nt_image_headers32
mov byte [ebp - 0x23d], 0xc9
mov byte [ebp - 0x23c], 0xde
mov byte [ebp - 0x23b], 0x8c
mov byte [ebp - 0x23a], 0x8c
mov byte [ebp - 0x239], 0x8c
mov eax, dword [ebp - 0x244]
xor eax, 0x8c8c8c8c
mov dword [ebp - 0x244], eax
mov eax, dword [ebp - 0x240]
xor eax, 0x8c8c8c8c
mov dword [ebp - 0x240], eax
mov eax, dword [ebp - 0x23c]
xor eax, 0x8c8c8c8c
mov dword [ebp - 0x23c], eax
push 0x104
lea eax, [ebp - 0x108]
push eax
lea eax, [ebp - 0x244]
push eax
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
jne 0x4015cb
push 0x104
lea eax, [ebp - 0x108]
push eax
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
push 0
push 0x80
push 3
push 0
push 1
push 0x80000000
lea eax, [ebp - 0x108]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x230], eax
cmp dword [ebp - 0x230], 0xffffffff
jne 0x40160c
push 0
lea eax, [ebp - 0x108]
push eax
push 2
call fcn.00401215
add esp, 0xc
push 0
lea eax, [ebp - 4]
push eax
push 0x40
lea eax, [ebp - 0x22c]
push eax
push dword [ebp - 0x230]
call dword [sym.imp.KERNEL32.dll_ReadFile]
push 0
push 0
mov eax, dword [ebp - 0x1f0]
add eax, 0x18
push eax
push dword [ebp - 0x230]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 4]
push eax
push 0xe0
lea eax, [ebp - 0x1e8]
push eax
push dword [ebp - 0x230]
call dword [sym.imp.KERNEL32.dll_ReadFile]
push 0
push 0
push dword [ebp - 0x190]
push dword [ebp - 0x230]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 4]
push eax
push 0x38
lea eax, [ebp - 0x288]
push eax
push dword [ebp - 0x230]
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp dword [ebp - 4], 0x38
jne 0x4016a2
cmp dword [ebp - 0x288], 0x82d0b188
je 0x4016b5
push 0
lea eax, [ebp - 0x108]
push eax
push 0xd
call fcn.00401215
add esp, 0xc
push 0
push 0
mov eax, dword [ebp + 0xc]
imul eax, eax, 0xc
push dword [ebp + eax - 0x268]
push dword [ebp - 0x230]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [ebp + 0xc]
imul eax, eax, 0xc
mov eax, dword [ebp + eax - 0x260]
mov dword [ebp - 0x24c], eax
push dword [ebp - 0x24c]
push 0
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [ebp - 0x238], eax
push 0
lea eax, [ebp - 4]
push eax
push dword [ebp - 0x24c]
push dword [ebp - 0x238]
push dword [ebp - 0x230]
call dword [sym.imp.KERNEL32.dll_ReadFile]
and dword [ebp - 0x248], 0
cmp dword [ebp - 0x248], 0
je 0x401734
mov eax, dword [ebp - 0x248]
mov dword [0x401a60], eax
jmp 0x401755
push 0x40
push 0x101000
mov eax, dword [ebp + 0xc]
imul eax, eax, 0xc
push dword [ebp + eax - 0x264]
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov dword [0x401a60], eax
cmp dword [0x401a60], 0
jne 0x401775
push 0x401811
push 0x401811
push 0x80030008
call fcn.00401215
add esp, 0xc
cmp dword [ebp - 0x248], 0
jne 0x40179f
mov eax, dword [ebp + 0xc]
imul eax, eax, 0xc
push dword [ebp + eax - 0x264]
push dword [0x401a60]
push dword [ebp - 0x238]
call section..text___
add esp, 0xc
mov eax, dword [0x401a60]
mov dword [ebp - 0x250], eax
mov eax, dword [ebp - 0x250]
mov eax, dword [eax + 0x3c]
mov ecx, dword [0x401a60]
lea eax, [ecx + eax + 4]
mov dword [ebp - 0x1ec], eax
mov eax, dword [ebp - 0x1ec]
add eax, 0x14
mov dword [0x401a64], eax
mov eax, dword [0x401a64]
mov ecx, dword [0x401a60]
sub ecx, dword [eax + 0x1c]
mov dword [ebp - 0x234], ecx
cmp dword [ebp - 0x248], 0
jne 0x40180f
push dword [ebp - 0x234]
push dword [0x401a64]
call fcn.004013cf
pop ecx
pop ecx
mov eax, dword [0x401a64]
push dword [eax + 0x68]
call fcn.0040125f
pop ecx
leave
ret