Function at 0x40e1f0
Capabilities:
Allocate or change rwx memory

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x30
push ebx
push esi
push edi
lea edi, [edx + 0x1f]
mov ebx, ecx
and edi, 0xffffffe0
mov dword [ebp - 0xc], ebx
mov dword [ebp - 0x10], edi
jne 0x40e212
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
lea esi, [ebx + 4]
push esi
mov dword [ebp - 0x2c], esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov edx, dword [ebx + 0x3c]
mov eax, dword [ebx + 0x1c]
mov dword [ebp - 4], edx
mov dword [ebp - 0x30], eax
test edx, edx
je 0x40e336
mov eax, dword [edx + 0x18]
sub eax, dword [edx + 0x1c]
cmp eax, edi
jb 0x40e315
mov ecx, dword [edx + 0x28]
cmp ecx, edi
jae 0x40e250
test ecx, ecx
jne 0x40e315
mov eax, dword [edx + 0x2c]
xor ecx, ecx
mov edi, dword [edx + 0x20]
xor ebx, ebx
mov dword [ebp - 0x18], eax
mov eax, dword [edx + 0x24]
mov edx, dword [ebp - 0x10]
dec edx
mov dword [ebp - 0x24], eax
add eax, edx
mov dword [ebp - 0x20], edi
xor edx, edx
div dword [ebp - 0x24]
xor edx, edx
mov dword [ebp - 8], eax
mov dword [ebp - 0x14], edx
test edi, edi
je 0x40e2fb
nop dword [eax]
mov edi, dword [ebp - 0x18]
mov eax, dword [edi]
add edi, 4
mov dword [ebp - 0x18], edi
lea edi, [edx + 0x20]
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x1c], edi
cmp eax, 0xffffffff
jne 0x40e2a9
cmp ecx, ebx
mov dword [ebp - 0x14], edi
mov edx, edi
cmovbe ecx, ebx
mov ebx, ecx
xor ecx, ecx
jmp 0x40e2f6
mov eax, dword [ebp - 0x20]
mov edi, 0x20
cmp dword [ebp - 0x1c], eax
jbe 0x40e2ba
mov edi, eax
sub edi, edx
xor eax, eax
lea edx, [eax + 1]
test edi, edi
je 0x40e2f0
mov esi, dword [ebp - 0x2c]
inc eax
test dword [ebp - 0x28], edx
jne 0x40e2e1
inc ecx
cmp ecx, dword [ebp - 8]
jne 0x40e2ea
mov ebx, dword [ebp - 0x14]
sub eax, ecx
mov edi, dword [ebp - 4]
add ebx, eax
jmp 0x40e448
cmp ecx, ebx
cmovbe ecx, ebx
mov ebx, ecx
xor ecx, ecx
add edx, edx
cmp eax, edi
jb 0x40e2c3
mov edx, dword [ebp - 0x1c]
mov dword [ebp - 0x14], edx
cmp edx, dword [ebp - 0x20]
jb 0x40e280
mov eax, dword [ebp - 0x24]
mov edx, dword [ebp - 4]
mov edi, dword [ebp - 0x10]
imul eax, ebx
mov ebx, dword [ebp - 0xc]
mov dword [edx + 0x28], eax
mov edx, dword [edx + 0x14]
mov dword [ebp - 4], edx
jmp 0x40e32e
mov ecx, dword [edx + 0x14]
cmp eax, dword [ebp - 0x30]
jae 0x40e329
cmp edx, dword [ebx + 0x3c]
jne 0x40e329
test ecx, ecx
je 0x40e329
mov dword [ebx + 0x3c], ecx
mov edx, ecx
mov dword [ebp - 4], ecx
test edx, edx
jne 0x40e233
mov eax, dword [ebx + 0x1c]
cmp eax, dword [ebp - 0x10]
cmovae edi, eax
mov eax, dword [ebx + 0x20]
mov ebx, dword [ebx]
mov dword [ebp - 0x24], eax
test edi, edi
je 0x40e4da
call fcn.0040dab0
test ebx, ebx
jne 0x40e35b
mov ebx, dword [eax + 8]
mov eax, dword [eax]
dec edi
push 0x40
add edi, eax
neg eax
push 0x3000
and edi, eax
push edi
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualAllocEx]
mov dword [ebp - 0x20], eax
test eax, eax
je 0x40e4da
xor edx, edx
mov eax, edi
div dword [ebp - 0x24]
push 0x34
mov dword [ebp - 0x30], eax
lea ebx, [eax + 7]
shr ebx, 3
add ebx, 3
and ebx, 0xfffffffc
mov dword [ebp - 0x28], ebx
call fcn.004504af
mov dword [ebp - 4], eax
lea eax, [ebx + ebx]
push eax
mov dword [ebp - 0x2c], eax
call fcn.004504af
mov ecx, dword [ebp - 4]
add esp, 8
mov ebx, eax
test ecx, ecx
je 0x40e49a
test ebx, ebx
je 0x40e49a
push dword [ebp - 0x2c]
mov eax, dword [ebp - 0x20]
mov dword [ecx + 8], eax
mov eax, dword [ebp - 0x30]
mov dword [ecx + 0x20], eax
mov eax, dword [ebp - 0x24]
push 0
push ebx
mov dword [ecx], 0
mov dword [ecx + 4], 0
mov dword [ecx + 0xc], 1
mov dword [ecx + 0x10], 0
mov dword [ecx + 0x14], 0
mov dword [ecx + 0x18], edi
mov dword [ecx + 0x1c], 0
mov dword [ecx + 0x24], eax
mov dword [ecx + 0x28], edi
call fcn.00445960
mov edi, dword [ebp - 4]
add esp, 0xc
mov eax, dword [ebp - 0x28]
mov edx, edi
mov ecx, dword [ebp - 0xc]
add eax, ebx
mov dword [edi + 0x2c], ebx
mov dword [edi + 0x30], eax
call fcn.0040dd00
mov eax, dword [ebp - 0x10]
xor edx, edx
dec eax
mov ecx, dword [ebp - 0xc]
add eax, dword [edi + 0x24]
xor ebx, ebx
div dword [edi + 0x24]
mov dword [ebp - 8], eax
mov eax, dword [edi + 0x18]
add dword [ecx + 0x28], eax
push dword [ebp - 8]
mov ecx, dword [edi + 0x2c]
mov edx, ebx
call fcn.0040dc70
mov eax, dword [ebp - 8]
mov edx, ebx
mov ecx, dword [edi + 0x30]
dec eax
push eax
call fcn.0040dc70
mov eax, dword [edi + 0x24]
add esp, 8
imul eax, dword [ebp - 8]
mov ecx, dword [ebp - 0xc]
mov dword [edi + 0x28], 0
push esi
add dword [edi + 0x1c], eax
add dword [ecx + 0x2c], eax
mov edi, dword [edi + 0x24]
mov eax, dword [ebp - 4]
imul edi, ebx
add edi, dword [eax + 8]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 0xc]
mov edi, dword [eax]
call fcn.0040dab0
test edi, edi
jne 0x40e4ab
mov edi, dword [eax + 8]
mov eax, dword [ebp - 0x20]
push 0x8000
push 0
push eax
push edi
call dword [sym.imp.KERNEL32.dll_VirtualFreeEx]
mov eax, dword [ebp - 4]
test eax, eax
je 0x40e4cd
push eax
call fcn.0044ab7f
add esp, 4
test ebx, ebx
je 0x40e4da
push ebx
call fcn.0044ab7f
add esp, 4
push esi
xor edi, edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret