Function at 0x4014c0
Capabilities:
Allocate or change rwx memory
Execute shellcode via indirect call
Get system information on windows
Get thread local storage value
Parse pe header

Disassembly:
push ebp
mov ebp, esp
mov eax, dword [ebp + 8]
sub esp, 0x30
push ebx
push esi
mov ecx, 0x5a4d
push edi
mov edi, dword [ebp + 0x14]
mov esi, 0x900000
cmp word [eax], cx
je 0x401501
lea edx, [ebp + 8]
mov dword [ebp + 8], str.Not_a_valid_executable_file
push edx
push 1
push 1
push 0x20555a43
call dword [sym.imp.KERNEL32.dll_RaiseException]
mov ebx, dword [eax + 0x3c]
add ebx, eax
cmp dword [ebx], 0x4550
je 0x40151b
lea eax, [ebp + 8]
mov dword [ebp + 8], str.No_PE_header_found
push eax
jmp 0x4014e9
test edi, edi
je 0x40156b
call fcn.00401410
lea ecx, [ebp - 0x30]
not eax
push ecx
mov dword [ebp - 0xc], eax
call dword [sym.imp.KERNEL32.dll_GetSystemInfo]
mov eax, dword [ebp - 0xc]
test edi, eax
je 0x40154d
lea ebx, [ebx]
test esi, esi
je 0x40154a
inc edi
dec esi
test edi, eax
jne 0x401540
mov dword [ebp + 0x14], edi
mov ecx, dword [ebp - 0x2c]
xor edx, edx
mov eax, esi
div ecx
test edx, edx
je 0x40156b
lea ebx, [ebx]
dec esi
xor edx, edx
mov eax, esi
div ecx
test edx, edx
jne 0x401560
mov dword [0x5dfeb0], 0
test edi, edi
je 0x4015aa
cmp esi, dword [ebx + 0x50]
jb 0x4015aa
lea edx, [ebp - 0xc]
push edx
push 0x40
push esi
push edi
mov dword [ebp - 8], edi
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov eax, dword [ebp + 0x14]
push esi
push 0
push eax
call fcn.00410d00
add esp, 0xc
mov dword [0x5dfeb0], 1
jmp 0x4015c4
mov eax, dword [ebx + 0x50]
mov ecx, dword [ebx + 0x34]
push 0x40
push 0x2000
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov edi, eax
mov dword [ebp - 8], eax
test edi, edi
jne 0x4015f3
mov eax, dword [ebx + 0x50]
push 4
push 0x2000
push eax
push edi
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov edi, eax
mov dword [ebp - 8], edi
test edi, edi
jne 0x4015f3
lea ecx, [ebp + 8]
mov dword [ebp + 8], str.Cant_reserve_memory
push ecx
jmp 0x4014e9
push 0x14
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
xor ecx, ecx
mov dword [esi + 4], edi
mov dword [esi + 0xc], ecx
mov dword [esi + 8], ecx
mov dword [esi + 0x10], ecx
mov eax, dword [ebx + 0x50]
mov dword [ebp - 0xc], esi
cmp dword [0x5dfeb0], ecx
je 0x401626
cmp edi, ecx
jne 0x401637
push 4
push 0x1000
push eax
push edi
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
xor ecx, ecx
mov eax, dword [ebx + 0x54]
cmp dword [0x5dfeb0], ecx
je 0x40164b
cmp edi, ecx
je 0x40164b
mov dword [ebp - 4], edi
jmp 0x40165d
push 4
push 0x1000
push eax
push edi
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov edx, dword [ebx + 0x54]
add edx, dword [eax + 0x3c]
push edx
push eax
mov eax, dword [ebp - 4]
push eax
call fcn.0040cb60
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x3c]
mov eax, dword [ebp - 4]
push esi
add eax, edx
push ebx
mov dword [esi], eax
push ecx
mov dword [eax + 0x34], edi
call section..text
mov eax, edi
add esp, 0x18
sub eax, dword [ebx + 0x34]
je 0x40169e
push eax
mov eax, esi
call fcn.004011a0
add esp, 4
mov ecx, dword [ebp + 0x10]
mov edx, dword [ebp + 0xc]
push ecx
push edx
push esi
call fcn.004012b0
add esp, 0xc
test eax, eax
jne 0x4016db
lea eax, [ebp + 8]
push eax
push 1
push 1
push 0x20555a43
mov dword [ebp + 8], str.BuildImportTable
call dword [sym.imp.KERNEL32.dll_RaiseException]
push esi
call fcn.004010d0
mov ecx, dword [esi]
mov eax, dword [ecx + 0x28]
add esp, 4
test eax, eax
je 0x40178b
add eax, edi
jne 0x40170d
mov eax, str.Library_has_no_entry_point
call fcn.0040b040
call fcn.00401840
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
pushaw
push 0
push 1
push edi
call eax
mov dword [ebp + 8], eax
popaw
cmp dword [ebp + 8], 0
jne 0x401781
mov edi, dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov ebx, dword [ebp - 8]
mov dword [ebp + 8], str.Cant_attach_library_C
xor esi, esi
push esi
call edi
test eax, eax
je 0x401746
cmp eax, ebx
jbe 0x401746
cmp dword [eax], 0x2c6cfa5f
je 0x401768
inc esi
cmp esi, 0x80
jb 0x401733
mov eax, dword [ebp + 8]
call fcn.0040b040
mov esi, dword [ebp - 0xc]
call fcn.00401840
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [eax + 4]
call fcn.0040b040
mov esi, dword [ebp - 0xc]
call fcn.00401840
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov esi, dword [ebp - 0xc]
mov dword [esi + 0x10], 1
pop edi
mov eax, esi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret