Function at 0x403510
Capabilities:
Allocate or change rwx memory

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x38
mov eax, dword [ebp + 0xc]
mov ecx, dword [ebp + 0xc]
add ecx, dword [eax + 0x3c]
mov dword [ebp - 0x18], ecx
cmp dword [ebp + 8], 0
je 0x40352e
cmp dword [ebp + 0xc], 0
jne 0x403535
xor eax, eax
jmp 0x403742
mov edx, dword [ebp - 0x18]
mov eax, dword [edx + 0x50]
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x2c], 0
mov ecx, dword [ebp - 0x14]
push ecx
mov edx, dword [ebp + 0xc]
push edx
call dword [sym.imp.KERNEL32.dll_IsBadReadPtr]
test eax, eax
je 0x403566
push 0x57
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x403742
push 0x40
push 0x3000
mov eax, dword [ebp - 0x14]
push eax
push 0
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.KERNEL32.dll_VirtualAllocEx]
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jne 0x403595
push 0xe
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x403742
mov edx, dword [ebp - 0x14]
push edx
push 8
mov eax, dword [0x407b6c]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
jne 0x4035d4
push 0x8000
push 0
mov ecx, dword [ebp - 0xc]
push ecx
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_VirtualFreeEx]
push 0xe
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x403742
mov eax, dword [ebp - 0x14]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
mov edx, dword [ebp - 8]
push edx
call fcn.00401980
add esp, 0xc
mov eax, 8
imul ecx, eax, 5
mov edx, dword [ebp - 0x18]
lea eax, [edx + ecx + 0x78]
mov dword [ebp - 0x20], eax
mov ecx, dword [ebp - 0x20]
cmp dword [ecx + 4], 0
jbe 0x403705
mov edx, dword [ebp - 0x20]
cmp dword [edx], 0
jbe 0x403705
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp - 0xc]
sub ecx, dword [eax + 0x34]
mov dword [ebp - 0x38], ecx
mov edx, dword [ebp - 0x18]
mov eax, dword [ebp + 0xc]
sub eax, dword [edx + 0x34]
mov dword [ebp - 0x34], eax
mov ecx, dword [ebp - 0x20]
mov edx, dword [ebp - 8]
add edx, dword [ecx]
mov dword [ebp - 4], edx
mov eax, dword [ebp - 4]
cmp dword [eax], 0
je 0x4036d3
mov ecx, dword [ebp - 4]
cmp dword [ecx + 4], 8
jb 0x4036c2
mov edx, dword [ebp - 4]
mov eax, dword [edx + 4]
sub eax, 8
shr eax, 1
mov dword [ebp - 0x30], eax
mov ecx, dword [ebp - 4]
add ecx, 8
mov dword [ebp - 0x24], ecx
mov dword [ebp - 0x10], 0
jmp 0x403674
mov edx, dword [ebp - 0x10]
add edx, 1
mov dword [ebp - 0x10], edx
mov eax, dword [ebp - 0x10]
cmp eax, dword [ebp - 0x30]
jae 0x4036c2
mov ecx, dword [ebp - 0x10]
mov edx, dword [ebp - 0x24]
movzx eax, word [edx + ecx*2]
test eax, eax
jle 0x4036c0
mov ecx, dword [ebp - 0x10]
mov edx, dword [ebp - 0x24]
movzx eax, word [edx + ecx*2]
and eax, 0xfff
mov ecx, dword [ebp - 4]
mov edx, dword [ecx]
add edx, eax
add edx, dword [ebp - 8]
mov dword [ebp - 0x1c], edx
mov eax, dword [ebp - 0x1c]
mov ecx, dword [eax]
sub ecx, dword [ebp - 0x34]
mov edx, dword [ebp - 0x1c]
mov dword [edx], ecx
mov eax, dword [ebp - 0x1c]
mov ecx, dword [eax]
add ecx, dword [ebp - 0x38]
mov edx, dword [ebp - 0x1c]
mov dword [edx], ecx
jmp 0x40366b
mov eax, dword [ebp - 4]
mov ecx, dword [ebp - 4]
add ecx, dword [eax + 4]
mov dword [ebp - 4], ecx
jmp 0x403636
push 0
mov edx, dword [ebp - 0x14]
push edx
mov eax, dword [ebp - 8]
push eax
mov ecx, dword [ebp - 0xc]
push ecx
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
test eax, eax
je 0x4036f8
mov dword [ebp - 0x28], 1
jmp 0x4036ff
mov dword [ebp - 0x28], 0
mov eax, dword [ebp - 0x28]
mov dword [ebp - 0x2c], eax
mov ecx, dword [ebp - 8]
push ecx
push 8
mov edx, dword [0x407b6c]
push edx
call dword [sym.imp.KERNEL32.dll_HeapFree]
cmp dword [ebp - 0x2c], 0
jne 0x40373f
push 0x8000
push 0
mov eax, dword [ebp - 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.KERNEL32.dll_VirtualFreeEx]
push 0x1d
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x403742
mov eax, dword [ebp - 0xc]
mov esp, ebp
pop ebp
ret