Function at 0x61005080
Capabilities:
Allocate or change rwx memory

Disassembly:
push ebp
mov ecx, 0x1c
mov ebp, esp
push edi
lea eax, [ebp + 0xc]
lea edi, [ebp - 0x38]
push esi
push ebx
sub esp, 0x3c
mov esi, dword [ebp + 8]
mov dword [esp + 8], ecx
mov dword [esp + 4], edi
mov dword [esp], eax
call sub.KERNEL32.dll_VirtualQuery
sub esp, 0xc
test eax, eax
je 0x6100526d
mov edx, dword [ebp - 0x38]
mov eax, dword [ebp - 0x2c]
add eax, edx
mov edx, dword [esi + 0x114]
cmp edx, dword [ebp - 0x34]
ja 0x610051d7
mov eax, dword [esi + 0x118]
mov ecx, 0x2000
mov ebx, 1
mov dword [esp + 0xc], ebx
mov dword [esp + 8], ecx
sub eax, edx
mov dword [esp + 4], eax
mov dword [esp], edx
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
je 0x61005279
mov eax, dword [esi + 0x40]
mov ebx, dword [esi + 0x118]
sub ebx, eax
mov eax, 0x40
mov dword [esp + 0xc], eax
mov eax, 0x1000
mov dword [esp + 8], eax
mov eax, dword [esi + 0x40]
mov dword [esp], ebx
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
je 0x61005299
mov dword [esp + 4], edi
mov eax, 0x1c
mov dword [esp + 8], eax
mov dword [esp], ebx
call sub.KERNEL32.dll_VirtualQuery
sub esp, 0xc
test eax, eax
je 0x61005261
mov edx, dword [ebp - 0x38]
mov ebx, 1
mov eax, dword [0x611630ec]
dec edx
mov dword [ebp - 0x38], edx
movzx eax, byte [eax + 0x10]
mov dword [esp + 4], ebx
mov dword [esp], edx
shr al, 4
and al, 1
cmp al, 1
sbb eax, eax
and eax, 0xfffffec1
add eax, 0x140
mov dword [esp + 0xc], eax
mov eax, 0x1000
mov dword [esp + 8], eax
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
je 0x610052b0
mov dword [esp + 4], edi
mov eax, 0x1c
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x38]
mov dword [esp], eax
call sub.KERNEL32.dll_VirtualQuery
sub esp, 0xc
test eax, eax
je 0x61005261
mov eax, dword [ebp - 0x38]
mov dword [esi + 0x114], eax
mov eax, dword [ebp + 0xc]
mov byte [eax], 0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
cmp edx, eax
jae 0x610050c9
mov edx, eax
mov eax, dword [esi + 0x118]
mov ecx, 0x2000
mov dword [esp + 8], ecx
mov ebx, 1
mov dword [esp + 0xc], ebx
sub eax, edx
mov dword [esp + 4], eax
mov dword [esp], edx
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
je 0x61005279
mov eax, dword [esi + 0x40]
mov ebx, dword [esi + 0x118]
sub ebx, eax
mov eax, 0x40
mov dword [esp + 0xc], eax
mov eax, 0x1000
mov dword [esp + 8], eax
mov eax, dword [esi + 0x40]
mov dword [esp], ebx
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
je 0x61005299
mov dword [esp + 4], edi
mov eax, 0x1c
mov dword [esp + 8], eax
mov dword [esp], ebx
call sub.KERNEL32.dll_VirtualQuery
sub esp, 0xc
test eax, eax
jne 0x6100519d
mov dword [esp], str.fork:_couldnt_get_new_stack_info___E
call sym.___api_fatal
mov dword [esp], str.fork:_couldnt_get_stack_info___E
call sym.___api_fatal
mov eax, dword [esi + 0x118]
mov dword [esp + 8], eax
mov eax, dword [esi + 0x114]
mov dword [esp], str.fork:_cant_reserve_memory_for_stack__p____p___E
mov dword [esp + 4], eax
call sym.___api_fatal
mov eax, dword [esi + 0x40]
mov dword [esp + 4], ebx
mov dword [esp], str.fork:_cant_commit_memory_for_stack__p__d____E
mov dword [esp + 8], eax
call sym.___api_fatal
mov dword [esp], str.fork:_couldnt_allocate_new_stack_guard_page__p___E
mov eax, dword [ebp - 0x38]
mov dword [esp + 4], eax
call sym.___api_fatal
nop
lea esi, [esi]
lea edi, [edi]