Function at 0x40c814
Capabilities:
Allocate or change rwx memory

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffb8
push ebx
push esi
push edi
lea eax, [ebp - 0x48]
mov edx, dword [0x4080b0]
call fcn.00403e7c
xor eax, eax
push ebp
push 0x40ca96
push dword fs:[eax]
mov dword fs:[eax], esp
cmp dword [0x54b6b0], 0
setne byte [ebp - 1]
cmp byte [ebp - 1], 0
jne 0x40ca7a
xor edx, edx
mov eax, dword [0x549adc]
call fcn.0040aaf0
mov dword [0x54b6b0], eax
cmp dword [0x54b6b0], 0
je 0x40ca7a
xor edx, edx
mov eax, dword [0x549abc]
call fcn.0040a9e4
lea edx, [ebp - 0x48]
call fcn.0040a898
cmp byte [ebp - 0x48], 0
jne 0x40c89a
xor edx, edx
mov eax, dword [0x549ab8]
call fcn.0040a9e4
lea edx, [ebp - 0x48]
call fcn.0040a898
mov eax, dword [ebp - 0x28]
call fcn.004043b4
test eax, eax
jl 0x40ca6d
inc eax
xor ebx, ebx
mov esi, ebx
shl esi, 3
sub esi, ebx
mov edx, dword [ebp - 0x28]
cmp dword [edx + esi*4 + 0x14], 0
jne 0x40c8cc
mov edx, dword [ebp - 0x28]
cmp dword [edx + esi*4 + 0x18], 0
je 0x40ca65
mov edx, dword [ebp - 0x28]
mov edx, dword [edx + esi*4 + 0xc]
cmp edx, dword [0x54b6b0]
jne 0x40ca65
mov eax, dword [ebp - 0x28]
cmp byte [eax + esi*4 + 0x10], 0
je 0x40c959
mov eax, dword [ebp - 0x28]
mov edi, dword [eax + esi*4 + 0xc]
mov eax, dword [ebp - 0x28]
sub edi, dword [eax + esi*4 + 0x14]
sub edi, 4
lea eax, [ebp - 8]
push eax
push 0x40
push 4
mov eax, ebx
shl eax, 3
sub eax, ebx
mov edx, dword [ebp - 0x28]
mov eax, dword [edx + eax*4 + 0x14]
push eax
call sub.KERNEL32.dll_VirtualProtect
test eax, eax
je 0x40ca48
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0x14]
mov dword [0x549ba8], eax
mov eax, dword [0x549ba8]
mov eax, dword [eax]
mov dword [0x549bac], eax
mov eax, dword [0x549ba8]
mov dword [eax], edi
lea eax, [ebp - 8]
push eax
mov eax, dword [ebp - 8]
push eax
push 4
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0x14]
push eax
call sub.KERNEL32.dll_VirtualProtect
jmp 0x40ca48
mov eax, dword [ebp - 0x28]
cmp dword [eax + esi*4 + 0x18], 0
je 0x40c9ea
push 0
push 4
call fcn.0040bf58
mov dword [0x549ba4], eax
mov eax, dword [0x549ba4]
mov dword [eax], 0x40c7d0
lea eax, [ebp - 8]
push eax
push 0x40
push 4
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0x18]
push eax
call sub.KERNEL32.dll_VirtualProtect
test eax, eax
je 0x40c9d5
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0x18]
mov dword [0x549bb0], eax
mov eax, dword [0x549bb0]
mov eax, dword [eax]
mov dword [0x549bb4], eax
mov eax, dword [0x549bb0]
mov edx, dword [0x549ba4]
mov dword [eax], edx
lea eax, [ebp - 8]
push eax
mov eax, dword [ebp - 8]
push eax
push 4
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0x18]
push eax
call sub.KERNEL32.dll_VirtualProtect
lea eax, [ebp - 8]
push eax
push 0x20
push 4
mov eax, dword [0x549ba4]
push eax
call sub.KERNEL32.dll_VirtualProtect
jmp 0x40ca48
lea eax, [ebp - 8]
push eax
push 0x40
push 4
mov eax, ebx
shl eax, 3
sub eax, ebx
mov edx, dword [ebp - 0x28]
mov eax, dword [edx + eax*4 + 0x14]
push eax
call sub.KERNEL32.dll_VirtualProtect
test eax, eax
je 0x40ca48
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0x14]
mov dword [0x549bb0], eax
mov eax, dword [0x549bb0]
mov eax, dword [eax]
mov dword [0x549bb4], eax
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0xc]
mov edx, dword [0x549bb0]
mov dword [edx], eax
lea eax, [ebp - 8]
push eax
mov eax, dword [ebp - 8]
push eax
push 4
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + esi*4 + 0x14]
push eax
call sub.KERNEL32.dll_VirtualProtect
cmp dword [0x549bb0], 0
jne 0x40ca5e
cmp dword [0x549ba8], 0
jne 0x40ca5e
xor eax, eax
jmp 0x40ca60
mov al, 1
mov byte [ebp - 1], al
jmp 0x40ca6d
inc ebx
dec eax
jne 0x40c8ad
cmp byte [ebp - 1], 0
jne 0x40ca7a
xor eax, eax
mov dword [0x54b6b0], eax
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x40ca9d
lea eax, [ebp - 0x48]
mov edx, dword [0x4080b0]
call fcn.00403f40
ret