Function at 0x40a840
Capabilities:
Allocate or change rwx memory
Execute shellcode via indirect call

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
mov esi, eax
push ebx
sub esp, 0x4c
mov dword [ebp - 0x40], ecx
mov ecx, dword [0x412064]
mov dword [ebp - 0x3c], edx
test ecx, ecx
jle 0x40aa30
mov edx, dword [0x412068]
xor ebx, ebx
mov eax, dword [edx + 4]
cmp esi, eax
jb 0x40a87c
mov edi, dword [edx + 8]
add eax, dword [edi + 8]
cmp esi, eax
jb 0x40a950
add ebx, 1
add edx, 0xc
cmp ebx, ecx
jne 0x40a867
mov dword [esp], esi
call fcn.0040b2c0
test eax, eax
mov edi, eax
je 0x40aa57
lea ecx, [ebx + ebx*2]
shl ecx, 2
mov ebx, ecx
add ebx, dword [0x412068]
mov dword [ebp - 0x44], ecx
mov dword [ebx + 8], eax
mov dword [ebx], 0
call fcn.0040b3b0
mov ecx, dword [ebp - 0x44]
lea edx, [ebp - 0x34]
mov dword [ebp - 0x48], edx
add eax, dword [edi + 0xc]
mov dword [ebx + 4], eax
mov eax, dword [0x412068]
mov dword [esp + 4], edx
mov ebx, dword [sym.imp.KERNEL32.dll_VirtualQuery]
mov dword [esp + 8], 0x1c
mov eax, dword [eax + ecx + 4]
mov dword [esp], eax
call ebx
mov ecx, dword [ebp - 0x44]
mov edx, dword [ebp - 0x48]
sub esp, 0xc
test eax, eax
je 0x40aa37
mov eax, dword [ebp - 0x20]
cmp eax, 4
jne 0x40a9d4
add dword [0x412064], 1
mov dword [esp + 8], 0x1c
mov dword [esp + 4], edx
mov dword [esp], esi
call ebx
sub esp, 0xc
test eax, eax
je 0x40aa67
mov eax, dword [ebp - 0x20]
cmp eax, 4
jne 0x40a960
mov eax, dword [ebp - 0x40]
mov dword [esp], esi
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x3c]
mov dword [esp + 4], eax
call sub.msvcrt.dll_memcpy
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
lea edx, [ebp - 0x34]
mov ebx, dword [sym.imp.KERNEL32.dll_VirtualQuery]
jmp 0x40a90a
cmp eax, 0x40
je 0x40a92e
mov eax, dword [ebp - 0x28]
lea edi, [ebp - 0x38]
mov ebx, dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov dword [esp + 0xc], edi
mov dword [esp + 8], 0x40
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call ebx
mov eax, dword [ebp - 0x40]
sub esp, 0x10
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x3c]
mov dword [esp], esi
mov dword [esp + 4], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp - 0x20]
cmp eax, 0x40
je 0x40a944
cmp eax, 4
je 0x40a944
mov eax, dword [ebp - 0x38]
mov dword [esp + 0xc], edi
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x28]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call ebx
sub esp, 0x10
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
cmp eax, 0x40
je 0x40a903
mov eax, dword [ebp - 0x28]
add ecx, dword [0x412068]
mov dword [ebp - 0x44], edx
mov dword [esp + 8], 0x40
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x34]
mov dword [esp + 0xc], ecx
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov edx, dword [ebp - 0x44]
sub esp, 0x10
test eax, eax
jne 0x40a903
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp], str.__VirtualProtect_failed_with_code_0x_x
mov dword [esp + 4], eax
call fcn.0040a7e0
lea esi, [esi]
xor ebx, ebx
jmp 0x40a886
mov eax, dword [0x412068]
mov eax, dword [eax + ecx + 4]
mov dword [esp + 8], eax
mov eax, dword [edi + 8]
mov dword [esp], str.__VirtualQuery_failed_for__d_bytes_at_address__p
mov dword [esp + 4], eax
call fcn.0040a7e0
mov dword [esp + 4], esi
mov dword [esp], str.Address__p_has_no_image_section
call fcn.0040a7e0
mov dword [esp + 8], esi
mov dword [esp + 4], 0x1c
mov dword [esp], str.__VirtualQuery_failed_for__d_bytes_at_address__p
call fcn.0040a7e0
nop